I have an HP ML 310 server running CentOS Linux 5.5. I'm buying a RAID card (LSI 9260-8i) to set up a mirrored OS drive. Right now, the boot drive is set up with GRUB installed on the MBR of /dev/sda & has a 100MB /boot partition for /dev/sda1, then the rest is configured in LVM with a 20GB with a 20GB VG for the root partition & ~80GB VG for home. The new disk sizes will also be slightly larger as well. What is the best way to clone the boot drive to the new CCISS device?
I think you should think more about a full backup/reinstall/restore cycle. You could use DD but the different disk sizes don't help there.
You can also use
tar
or any other tool to get a full dump of the filesystem, repartition the new disk and untar all the stuff to the right places. You can even do it over a network and livecd/usb image usingnc
:Machine to receive the backup (
/target
is where your new disk partitions are mounted):Machine where the backup is:
I do it often this way:
create the partitions on the new drive, "cloning" the partition layout. Partitions don't have to be same size, equal or bigger.
rsync whole partitions from one disc to the new one (rsync -avx --exclude=/proc --exclude=/sys --exclude=/dev --exclude=... , "-x" so it does not go over file system boundaries)
if partition layout changed, adapt /etc/fstab
some OS'es use /dev/disk/by-id/... naming and this will change on your new devices, adapt therefore /etc/fstab, /boot/grub/menu.lst, perhaps /boot/grub/device.map, ...
if cloning to a new system wou would have to adapt MAC addresses also, but this is not the case here ...
Have fun.
Since you are using LVM, using LVM snapshots is a good idea. I am not a fan of cloning LVM volumes because the Universally Unique elements that are essential to proper LVM function are no longer that Universally Unique. You never know how much your system will continue running with old and new hardware. I would suggest leveraging LVM's snapshot technology for everything other the your boot volume. Basically, you have VG_existing, and you will have to add your PVs to a new group VG_new, you will create new LVs under this group, and use same exact names as LVs i VG_old. Then you can create a snapshot of each volume in VG_old, and basically do a 'dd' from each snapshot to an identically named volume in your new group. This way you will not have a hobbled LVM configuration, and you can do this with a system live, no need for any real downtime. You will need to adjust grub later, and you are all set.
Am I missing something? There's no cciss device here. cciss generally represents the block devices tied to Compaq/HP Smart Array controllers. The LSI should show up as a /dev/sd[x] device. Either way, I'd recommend the backup, install, restore method here as mentioned in earlier comments.
Some excellent answers here, but I wanted to post my own to document what I did that worked. Most of it can be found Googling easily, but one key step kept me at work late.
With the new, unformatted disks installed (old & new disks in the system), assume /dev/sda is the old disk & /dev/sdb is the new & sda is the boot device. I did this from a CentOS DVD booting to "linux rescue":
uname -r
.imguname -r
(replace uname -r with your most recent kernel version. using backticks with uname -r might work in the command.)The part that had me stumped was mkinitrd, which was necessary because the system disk was behind a new controller & the drivers were not built into the previous initrd image. Without them, it would start to boot but couldn't find the LVM's.