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

Re: Cloning hdds of different sizes



You can do this several ways.

Way 1)

Filesystem level copy + grub install.

a)Use a rescue or minimal live boot environment, partition your new
disk as you like; complete the minimal install.
b)Drop to a shell in the live environment, and mount the new root and
fstab layout under a tmp target mount point (i tend to use
/mnt/new<subfilesystems) creating each of the sub file system mount
directorys under the root then mounting them in turn
c)Mount the old filesystem (i.e /mnt/old ) and any subfilesystems
d) Use rsync to copy everything under /mnt/old to /mnt/new (rsync
-pPvra /mnt/old /mnt/new) - you may want to exclude /mnt/old/dev and
/mnt/old/proc )
e) Bind mount the live filesystems proc,sysfs and dev mounts to the
/mnt/new  ( i.e mount -o bind /dev /mnt/new/dev ; mount -t sysfs
/mnt/new/sysfs mount -t proc none /mnt/new/proc )
d) chroot to the new directory ( chroot /mnt/new /bin/bash )
e) fix up any device pointers in /etc/fstab (you might need to change
around /dev/sdX etc to accord to the new filesystem parition/device ID
- a better method is to get the UUID of the block device using blkid
and add that into the /etc/fstab for each fo the mount points than
using changable /dev entrys)
f) run grub-install from the chroot.
g) Done.


Way2) (actually more risky and less easy than the above IMHO and will
only work with an msdos disk label )

Block copy + fixup disk boundrys by hand + add paritions at the end
a) Boot a live environment
b) ddrescue /dev/old to /dev/new after running sfdisk on the old and
new and keeping a copy of the cylinder/layout info somewhere to refer
to
c) partprobe the new /dev/new
e) Run gparted/parted and align sectors etc
f) Add/resize the last parition to fill the space
g) Cross fingers.




-Joel
http://gplus.to/aenertia
@aenertia


On 28 May 2014 11:03, Catalin Soare <lolinux.soare@gmail.com> wrote:
> Hello,
>
> 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.
>
> Thank you for any suggestions,
>
> --
> Sent from my Brick (TM)


Reply to: