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

Re: Cloning hdds of different sizes



On Wed, 28 May 2014 02:03:48 +0300
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.

Sounds to me like a job for dd, or more specifically, ddrescue.
ddrescue is featured on the System Rescue CD
(http://www.sysresccd.org/SystemRescueCd_Homepage). With ddrescue's
logs and many ways of writing, you can be assured of the maximum
possible likelihood of getting the job done, and finding out if either
drive has problems that should concern you.

If you want a quick way of cloning the drive that isn't particularly
error prone, this is it, especially if your 250 is fairly full so that
file by file copy wouldn't save you much. If both drives are in good
shape so there are no misreads or miswrites, I'd imagine the clone will
take about an hour, unattended.

If there are disk problems it will take longer, but file by file might
have missed that fact and written bad data.

> 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?

After cloning the 250 onto the 300, the 300 will boot just like the
250, always assuming your last step before doing the clone is to get
rid of the 300's entry in fstab. Labels and blkids on the 300 will be
identical to the 250's after cloning.

> 
> 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?

Now you're getting a little complicated. What I always do in this
situation is just make an additional partition to consume that last bit
of drive space, and usually find a use as a scratchpad area for that
partition.

Or, if you really want to make /home bigger, you can take the biggest
subdirectory in /home significantly smaller than the new partition,
rsync its contents to the new partition after mounting it, back them up
somewhere else, remove them leaving only the empty directory on the
original, and mount the new partition as that directory.

If you want to expand a partition to include the unallocated space, I
think you have to use whatever partition butts up against the
unallocated space to make bigger. If there's a tool to enlarge a
different partition and move the others to compensate, I"m not aware of
it.

SteveT

Steve Litt                *  http://www.troubleshooters.com/
Troubleshooting Training  *  Human Performance


Reply to: