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

Re: [debian-user] How to copy a laptop HD?



Thanks to all replies...

I got the cloning working.  The recipe that finally worked was pretty
similar to the "dd" provided but with some differences, because I
couldn't get the MBR correctly working with other recipes, :(

Suppositions:

1.-  New HD is bigger than old one, so that the free space left is
enough to contain the partition you'd like to get bigger.
2.-  The partition to get bigger is the higher one (most to the right).
3.-  There's a gParted live CD available or something that would allow
resizing root partition (of course it can't be mounted then).

Recipe:

1.-  Clone entire HD from old HD into new one (dd if=/dev/hda
of=/dev/sda).  This will end up generating the exact old HD structure,
but for some reason the higher partition (most to the right) can't get
resized to a bigger one (as if it was of a fixed size), although
cfdisk shows the free space that could be used.

2.-  Halt and swap HD's.  This will work out of the box, :)...

3.-  Generate a higher partition, at the right of the currently higher
one.  Hopefully it'll end up being bigger or at least the same size as
the one intended to be expanded.  Generate its FS (mke2fs -j -L "..."
/dev/hda8)

4.-  Clone the partition originally intended to be bigger into the new
generated one (dd if=/dev/hda7 of=/dev/hda8).  This will still show up
weird things, like even though cfdisk will show some size for the new
partition (in my case way bigger than originally intended partition to
be expanded), "df -h" will say that the FS is exactly the same size as
the originally copied.  But that'll get overcome, :).

5.-  Remove original partition just copied, which wasn't allowed to be extended.

6.-  Reboot.  At this point there's no problem with grub menu because
hd8 became hda7 by removing the original partition, :).  This is just
to check everything went OK, and system could be rebooted, etc.

7.-  Resize new generated partition.  As this for me it was the root
partition, I had to do it with a live CD, the gParted one.  When using
gParted, the weird thing about cloning the partition with dd still
showed up.  I saw a big partition, but mostly the size of the copied
one showed up as used, which I knew was wrong...  Any ways, expand the
partition to the left (I didn't leave any free space to the right, so
there was no room for expanding in that direction), meaning expanding
from the header of the partition.  At the end the partition is showed
bigger, and with the right amount of data (which is less than the size
of the copied partition even though at the beginning the used data was
showed to be that big).

8.-  Reboot the system, check with cfdisk, and "df -h /" for example, etc...

I'm not sure why some things that were supposed to work as I was doing
things before (like trying to clone the MBR without the partition
table, etc) didn't work, but this just worked out...

Thanks again for the help,

-- 
Javier


Reply to: