How do I clone a drive and resize (downsize) a partition ? fdisk verify warning.

Bill Davidsen davidsen at tmr.com
Mon Jul 5 02:05:11 UTC 2010


Linuxguy123 wrote:
> I'm moving /, /boot and swap from a conventional hard drive to an SSD.
> 
> Both drives are 160 GB in size.
> 
> I want to resize the /boot and swap partitions from 200 MB and 2 GB to
> 500 MB and 8 GB respectively.   The first resize is because preupgrade
> now fails to run unless /boot is 500 MB or larger and the second because
> the swap file is supposed to be as big as the RAM in the computer and my
> laptop currently has 4GB and I want to upgrade to 8 GB in the future.
> 
> So... I partitioned the SSD to the appropriate sizes.   I then ran
> Clonezilla and installed the /boot data seemingly without any problem.
> I used the expert mode and told it to resize things to fit the new /boot
> partition size. 
> 
Assuming that you can connect both, create the partitions on the SSD, put a 
filesystem on each SSD partition, and mount everything.

Example only:
   mkdir /{old,new}_disk
   mount /dev/sda2 /old_disk		# root
   mount /dev/sda1 /old_disk/boot	# boot
   mount /dev/sdb2 /new_disk
   mount /dev/sdb1 /new_disk/boot
   cd /old_disk
   cp -a ./ new_disk/

The archive options of cp (as root) should copy everything.

Instead of the cp you could use rsync:
   rsync -a /old_disk/ /new_disk/	# type as shown, trailing / needed

Then chroot to the new disk root and install grub.

-- 
Bill Davidsen <davidsen at tmr.com>
   "We have more to fear from the bungling of the incompetent than from
the machinations of the wicked."  - from Slashdot


More information about the users mailing list