Tuesday, January 15, 2013

add a second disk to ZOL boot RAID array

note to self: (from zfs-discuss list):


Having made a bootable installation of Linux on ZFS using this HOWTO, I was slightly puzzled as to how to add a second disk to the array and make the second disk bootable. In the end I did the steps below. They may be simple to many people, but gave me a bit of trouble. I wonder if a small addition to the HOWTO to deal with the case of adding extra disks to an existing system would be of any use?

Steps taken:
------------

Boot the system with the Linux disk and the new, blank hard disk attached.

Login and run 'sfdisk -l'. This shows from the partition tables which disk is the Linux one and which is the blank one. In this example the Linux disk is /dev/sda and the new disk is /dev/sdb.

Run 'sfdisk /dev/sda -O table' to dump the partition table of the Linux disk.

Run 'vi table' and change references to 'sda' to 'sdb' (This step probably not necessary, but won't hurt)

Run 'sfdisk /dev/sdb < table' to copy the partition table of the Linux disk to the blank disk.

Run 'sfdisk -R /dev/sdb' to get the kernel to reload the new partition table.

Do 'sfdisk -l' - both disks should have the same partition table.

Run 'ls -l /dev/disk/by-id' | grep scsi' to get the disk IDs which relate to sda and sdb. Note which is which.

Run 'zpool status'. It should show that the device ID corresponding to sda is online. Also note the pool name (eg 'tank01')

Do 'zpool attach [pool name] [existing attached disk id] /dev/disk/by-id/[id of disk to be attached]-part[x]' where 'part-[x]' refers to the partition number of the partition for ZFS storage.

Run 'zpool status'. The pool should be resilvering. Wait for this to complete before reboot.

As in the howto, do 'mke2fs -m 0 -L /boot/grub -j /dev/disk/by-id/[id of new disk]-part[x]' where [x] is the partition number for the Grub partition.

Do 'umount /boot/grub', then 'mount /dev/sdb1 /boot/grub' (assuming the Grub partition is the first one).

Do 'grub-install /dev/sdb', then 'update-grub'

Shut down the system and detach the original Linux disk. The new disk should now boot into Linux.

No comments:

Post a Comment

/* */ Google Analytics Alternative