Remco.org

Seductive serendipity / Verleidende serendipiteit

January 28th, 2011

‘DCF77-PPS’ experiments with LinuxPPS

A while ago I posted the idea to use the rising edge of DCF77-pulses as PPS-generator. At that time LinuxPPS was not in the kernel
and it was a ‘small project’ (read: challenge ; -) to apply the necessary kernel patches, and to get it running.

As of linux-2.6.34 LinuxPPS is within the kernel and it can be easily activated in (k)Ubuntu 9.10 and onwards with:

ldattach pps /dev/ttyS0 (when the PPS source is connected to ttyS0 (COM1)

The necessary modules (pps_core and pps_ldisc) are automagically loaded when issuing the ldattach command.

You can monitor the PPS stamps with:  watch -n1 cat /sys/class/pps/pps0/assert .

After this, start a freshly compiled ntpd (see LinuxPPS wiki on how to do this) and use the ATOM driver (driver 22).

To make a long story short, although DCF77 misses the 59th ‘second’, the kernel stays within +/- 1 ms lock on my system.

Actually, this is surprisingly good, considering the distance between me and the DCF77-transmitter.

Real time results are visible here.  Below you find three snapshots.

PS.  For whatever reason the PARSE driver (driver 8 ) of ntpd cannot decode the DCF77 time with the PCIe RS232 card on my system. With ‘native’ (i.e. on board)
serial interfaces I didn’t encounter problems but with the current setup I keep getting errors like:

22 Jan 14:30:00 ntpd[17670]: parse: convert_rawdcf: parity check FAILED for “###############RADMLS1248124P124812P1248121241248112481248P”
22 Jan 14:30:00 ntpd[17670]: PARSE receiver #0: FAILED TIMECODE: “###############RADMLS1248124P124812P1248121241248112481248″ (check receiver configuration / wiring)

Anyone … ?

January 1st, 2011

Kubuntu install with ‘all’ LVM

This post tries to explain how to install Kubuntu (10.10) when you’ve one primary partition left.
Information on how to install and boot a system where /boot is not on a primary partition, is scarce.

Recently I bought a Dell Inspiron 580 with a single 1.5 TB disk, with Windows 7 installed. Although I run Linux, I wanted to leave the Windows 7 installation untouched (just in case of…).
So, a dual boot system was the way to go.

First, I removed the Dell Datasafe Local Backup option because it seems to overwrite your MBR.

My Inspiron came with the following partitioning scheme (as could be seen with the Kubuntu installation .iso, which had been copied to a USB-drive with usb-creator-kde):

/dev/sda1     149MB   (type ‘de’ <- a ‘Dell thing’)
/dev/sda2     11.15GB (type ’7′ <- NTFS) ‘ RECOVERY’ (<- presumably the W7-system backup/recovery)
/dev/sda3     1.3TB (type ’7′ <- NTFS) ‘OS’ (<- the Windows7 partition)

I downsized /dev/sda3 to 225GB (google on how to do this), resulting in an unallocated partition of ca. 1.1TB.

Subsequently I created a new primary partition by booting Kubuntu using the USB-drive. I chose the ‘Try Kubuntu’-option.
A new primary partition (/dev/sda4, type ’8e’, Linux LVM) was allocated to the remaining space using fdisk.

After this, the partition table looked like:

#> sudo fdisk -l
Disk /dev/sda: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0×38000000

Device Boot         Start         End      Blocks   Id  System
/dev/sda1               1          19      152586   de  Dell Utility
/dev/sda2   *          20        1488    11794432    7  HPFS/NTFS
/dev/sda3            1488       30808   235517228    7  HPFS/NTFS
/dev/sda4           30809      182401  1217670772+  8e  Linux LVM

We’re now in the process of using LVM. For a beginners guide, also on how to use fdisk, look here.

First install LVM on the USB-Kubuntu-system with:

sudo apt-get install lvm2

The freshly created LVM-partition (/dev/sda4) was assigned as a physical volume:

sudo pvcreate /dev/sda4

A volume group was created with:

sudo vgcreate lvmdisk /dev/sda4
(being lvmdisk the name of your lvm, you can name it whatever you want)

I created the following logical volumes (your mileage may vary ; -):

sudo lvcreate -n boot -L 100M lvmdisk
sudo lvcreate -n root -L 15G lvmdisk
sudo lvcreate -n home -L 500G lvmdisk
(I decided not to use the full available space and allocated 500 GB to /home)
sudo lvcreate -n swap -L 16G lvmdisk (I have 8GB of memory, so swap is not really necessary, but just in case of….)

After this, my ‘lvmdisk’ looked like:

#> sudo lvscan
ACTIVE ‘/dev/lvmdisk/boot’ [100.00 MiB] inherit
ACTIVE ‘/dev/lvmdisk/root’ [15.00 GiB] inherit
ACTIVE ‘/dev/lvmdisk/home’ [500.00 GiB] inherit
ACTIVE ‘/dev/lvmdisk/swap’ [16.00 GiB] inherit

The logical volumes were formatted with the ext3 file system, except for the swap space:

sudo mkfs -j /dev/lvmdisk/boot -L boot
sudo mkfs -j /dev/lvmdisk/root -L root
sudo mkfs -j /dev/lvmdisk/home -L home
sudo mkswap /dev/lvmdisk/swap -L swap

At this point the logical volumes can be mounted and accessed as if they are ‘normal’ partitions.
E.g. sudo mount /dev/lvmdisk/root /mnt will mount the lvm-root volume to /mnt.

As a safety measure I backed up the MBR of my disk (/dev/sda) with:

sudo dd if=/dev/sda of=mbr.i580 bs=4096 count=1

To be utterly safe, I also copied mbr.i580 to another machine.
When ‘everything goes wrong’, the MBR can be restored with:

sudo dd if=mbr.i580 of=/dev/sda bs=4096 count=1

I now rebooted Kubuntu and chose the ‘Install Kubuntu’ option. When you reach the disk partitioning options, choose ‘Manual’.
A window appears where you can see which partitions are visible and accessible to the Kubuntu installer.
Besides the ‘physical’ volumes /dev/sda and /dev/sdf (in my case the Kubuntu-pendrive), the logical volumes are visible too.
When you right click e.g. /dev/lvmdisk/boot you can assign a mount point, in this case ‘/boot’. Do this for root (/) and home (/home) too.
The swap space is automagically recognized.

For the ‘Bootloader’ option, choose /dev/sda and proceed with the installation process (you’ll be warned that the data on the selected partitions will be deleted etc. , but persist! ; -)
After running through the whole (and fast!) Kubuntu installation procedure the machine asks for a reboot.

With my fingers crossed, the GRUB bootloader appeared with Kubuntu and Windows 7 options available. So far so good.
I chose (of course) Kubuntu and after a while I got an error. The root-partition could not be found. Oh.. oh..

Rebooting the machine with the Kubuntu-pendrive resulted in my observation that the new Kubuntu-system was not aware of LVM.
My pendrive was, because I installed LVM on it (see earlier in this post).

To install LVM on the fresh Kubuntu installation do (in the following order):

sudo mount /dev/lvmdisk/root /mnt
sudo mount /dev/lvmdisk/boot /mnt/boot

Now chroot into /mnt and install LVM:

sudo chroot /mnt
apt-get update
apt-get install lvm2

and .. reboot, choose Kubuntu and… ready!

|