[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Cloning hdds of different sizes



On Wed, 28 May 2014, Catalin Soare wrote:

> In one of my computers I have 2 HDDs. One of them is a 250 GB drive
> (debian) and the other is a 300 GB (data).
> 
> I've decided to give one of them to my parents because the one they
> have right now makes some strange noises. So I've backed up and
> cleaned up the drive, and as we speak I am cloning my debian install
> (from the 250 GB disk) onto the other drive.
> 
> My fstab contains blkids to identify the root, swap, and home
> partitions. Will the new clone just boot as if it was on the old
> drive?
> 
> Also is there a simple method to resize the future home partition and
> move the root partition so that I don't end up with unallocated space
> on the drive?
> Basically I'd like to have a bootable system while also being able to
> use the entire space on the disk.

I found rsync more suitable than dedicated cloning software.  I, too,
only had three parttions -- /, /home, and swap -- that I wanted to
enlarge and rearrange on a new larger drive.  Generally, here's the
procedure specific to your set up, not mine.

1. Boot with "old" system.

2. Partition the 300GB drive how you want it, and format the partitions.
For safety, I called for a badblock check before formatting.

3. Use blkid to get the UUIDs of each new partition and write them down.

3. Shutdown the system and boot with a Linux LiveCD. Use a 64-bit Live
if your system is 64-bit.  Similarly, if 32-bit.

4. Use rsync to copy the files on each partition of the 250GB drive
to the appropriate one on the 300GB.

5. Once the above copying is done, edit /etc/fstab on the 300GB drive
by inserting the new UUIDs for each partition.  Change labels, if
needed.

6. Set up a chroot to the new "cloned" system on the 300GB drive.

NOTE:  I initially used a 32-bit LiveCD when "cloning" my system, and
when I got to this step, the chroot to the 64-bit system on the drive
wouldn't work.  Booted with a 64-bit LiveCD, and it did.

7. Create a new initrd.img: Use grub-mkimage, IIRC.  This is probably
not necessary since we're cloning, but I did it on my system anyway.

8. Create a new grub.cfg:  Use grub-mkconfig.

9. Install to MBR of the 300GB drive: Use install-grub.

10.  Un-chroot, shutdown, remove or disconnect 250GB drive.

11. Reboot and see if it works.


That's as best as I can remember.  I made notes, but can't find them
right now.  Be sure to read and study all the mans for rsync, blkid,
chroot, and the grub utilites.  A search of the web for this procedure
wouldn't hurt either, especially the proper procedure for chrooting.

I didn't bother using GPT partitioning as MY new drive as it was only
500GB. The old one was 160GB.  So, neither should you.  Why make
trouble for yourself.  However, use a contemporary partitioning utility
that automatically begins the first partition at the proper sector
and aligns all the partitions.

Good luck.

B  



Reply to: