This weekend I had to move my 3 linux systems on a single 500Gb disk to a new 2Tb disk. I was getting a lot of SMART read errors, and that disk being a few years old, I decided it was time to upgrade. I did run into a few issues during this process, and this post outlines my process of getting things done.
Now you may ask why 3 linux systems? Well I have a multiboot system with
a) Windows 7 (purely for gaming)
b) Stable Linux partition (Currently Mint 13)
c) Two other linux distributions that I want to test or play around with. At the moment these are Mint 14 beta, and Xubuntu 12.10.
I know there there are tons of other ways of doing this, but this is the way I did it.
Now you may ask why 3 linux systems? Well I have a multiboot system with
a) Windows 7 (purely for gaming)
b) Stable Linux partition (Currently Mint 13)
c) Two other linux distributions that I want to test or play around with. At the moment these are Mint 14 beta, and Xubuntu 12.10.
I know there there are tons of other ways of doing this, but this is the way I did it.
Things to note:
- I have 2 disks - the 1st is a 1Tb Western Digital which holds a dedicated boot partition, and Windoze 7 (used for gaming)
- The 2nd was the Seagate 500Gb with 3 Linux systems, each one of them has their boot records on their individual partitions, i.e. grub-install --force /dev/sdb1
So what I did was:
- Installed the new disk alongside the current disk.
- Reboot with a live Mint 13 disk so that I was working in any of the 3 linux systems.
- Copied the partition table from the old disk to the new one.
sfdisk -d /dev/sdb | sfdisk /dev/sdc - Then I noticed that fdisk was complaining about "partition does not end on cylinder boundary". I know that this is not a major issue with the newer linux kernels and newer disks, but to me it is untidy and annoying, so I decided to fix it.
- So I deleted all the partitions on the new disk and using fdisk I created the partitions slightly larger than the old partitions. Using fdisk ensured that I did not get the "partition does not end on cylinder boundary" issue.
- Once I was happy that fdisk was not issuing any errors with "fdisk -l /dev/sdc" it was time to copy the individual partition data from the old disk to the new one.
- To do that I used "dd if=/dev/sdb1 of=/dev/sdc1", "dd if=/dev/sdb2 of=/dev/sdc2" and "dd if=/dev/sdb3 of=/dev/sdc3"
Now I thought that everything was good and it would just boot into any of these systems on the new disk, but I was wrong. The grub dedicated partition on the 1st disk was using:
search --no-floppy --fs-uuid --set=root 4876900a-0848-40bc-baee-6ecc4c42bb5b
chainloader +1
for each of these systems to boot from their individual boot sectors on their individual partitions, but each of them would hang as soon as it started to boot from them.
I checked that the uuid's were all the same and they were, using dd meant that the new partitions were in every way (except size) an exact replica of the old partitions. So I booted up again in my trusty live cd again and did the following:
- Resized each of the new partitions, because "df -h" showed them as being exactly the same size as the old partitions when in fact they were not:
resize2fs /dev/sdb1 , resize2fs /dev/sdb2 and resize2fs /dev/sdb2. - Then I checked each partition with:
e2fsck -f /dev/sdb1 , e2fsck -f /dev/sdb2 and e2fsck -f /dev/sdb3 - No errors were found and now the df -h showed their true sizes.
- Then I mounted each system in turn and did the following:
- for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt/sdb1$i; done
- chroot /mnt/sdb1
- grub-install --force /dev/sdb1
This then ensured that each system had it's boot sector reinstalled on their root partitions.