Re: Transplanting old System to New Drive
On 15/08/11 12:32, Martin McCormick wrote:
I have a 10-gigabyte hard drive that sounds like a 747
just before takeoff so the time has come to replace it. I
replaced it with a 16-gigabyte SATA flash drive and IDE adaptor
as the system it runs on is a little too old to handle a large
If I use dd to copy the 10-gig drive over to the new
drive as in:
dd if=/dev/hda of=/dev/hdb bs=20M
it works when I remove the old screamer drive, change the jumper
on the new drive to Master and boot but this is not very
efficient as it wastes almost 6 gigs of drive.
What I tried to do was to format /dev/hdb with hdb1
being around 15GB and then /dev/hdb2 being extended and holding
hdb5 marked as swap just like /dev/hda. /dev/hdb1 is also set to
bootable and shows up as such when using fdisk /dev/hdb and
then the p command.
The rsync command tries to copy everything on the old
disk except /proc and it also fails to copy those files which
probably never stay around such as timer values and other
volital information so /dev and everything else get copied.
When I boot the efficiently-built system, it does start
to boot and then hangs.
Is there a way to copy the working file system to a
larger drive such that the new drive will also boot?
Yes - read on.
In case you find this confusing, I mount the clean new
disk on /mnt2. The rsync command excludes "mnt2" to prevent
infinite recursion, but this pretty well describes what I am
trying to do.
I even tried to use the dd method and then tune2fs but I
either did something wrong or this can't work because I still
had only a 9.6G file system when all was said and done.
Thanks for any suggestions as to how to transplant the
old OS to the larger drive and still make it work.
I bet the MBR that is being put on the new drive can not
find grub or something along those lines because /boot and the
kernel are there. It really looks like it should work, but
That's part of the problem... of course all the UUIDs in fstab and
grub.cfg will refer to your old drive... ;-p
Martin McCormick WB5AGZ Stillwater, OK
OSU Information Technology Department Telecommunications Services Group
Probably *not* the recommended way to do it, but...
I regularly convert large, real machines to small, VirtualBox guest
machines - and move working multi-partition multi-disk builds to new
drives in new machines, so this method should work for you - I suspect
it's the mainly the last step you require. Note: cat will probably do
the job just as well - I'm lazy, rsync is fast and I know it preserves
1. Create new partitions big enough to hold the data you wish to copy -
it doesn't matter if they're larger or smaller than the original - just
as long as they're larger than the data you're going to put on them. To
save possible BIOS complaints if both drives reside on the same machine
- do not make the destination drive bootable (yet). This is in case you
need to reboot with both drives enabled for some reason before this
process is completed - probably not necessary, but - belt *and*
suspenders is good ;-)
2. Put the same file system on the new drive.
3. Mount the drives under a live CD. eg.:-
# mkdir /media/source0 media/source1 [etc, for each data partition on
the source drive]
# mkdir /media/dest0 /media/dest1 [etc, to match the source dirs]
4. use rsync to copy the files. eg.:-
# rsync -azr /media/source0/ /media/dest0 [rinse and repeat until all
5. fix fstab and grub.cfg on the new drive eg.:-
# blkid >> /media/dest0/boot/grub/grub.cfg
# blkid >> /media/dest0/etc/fstab
Then use nano or whatever to edit the UUIDs in grub.cfg and fstab. The
UUIDs of the partitions of the new drive will be at the bottom of those
files - just copy and paste, remove the UUIDS at the bottom of the
drives and save the files.
6. mark the new drive bootable eg.:-
# umount /media/dest*
# umount /media/source*
# fdisk /dev/destination_drive
7. If you are planning on keeping the original drive installed, make it
*not* bootable. Then:-
shutdown the machine.
8. Either remove the original hard drive or recable and rejumper, modify
the BIOS accordingly (SATA settings, disable IDE controller is not
needed etc, set boot order).
9. Boot up you new hard drive. Enjoy :-)
“We gotta come to some new ideas about life folks ok? I'm not being
blase about abortion, it might be a real issue, it might not, doesn't
matter to me. What matters is that if you believe in the sanctity of
life then you believe it for life of all ages. That's what I hate about
this child-worship syndrome going on. "Save the children! They're
killing children! How many children were at Waco? They're killing
children!" What does that mean? They reach a certain age and they're off
your [beep] love-list? [beep] your children, if that's the way you think
then [beep] you too. You either love all people of all ages or you shut
the [beep] up.”
~ Bill Hicks