Copying the system from one HD to another

Jeffrey Ross jeff at bubble.org
Tue Dec 26 02:06:01 UTC 2006


redhatdude at bellsouth.net wrote:
> Hi,
> My FC6 box has an internal 40 Gig ATA hard drive in it. I'd like to 
> upgrade it to an 80 Gig SATA drive. Is there a way to copy the whole 
> system from one to the other so I don't have to reinstall Fedora and 
> reconfigure all my services?
> Thanks
> EJ
>
> --fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
I'd recommend the following, first I'm assuming you are using an 
ext2/ext3 filesystem, if not you'll need to change the copy program.

1) Make note of how your partitions are created now and what you want to 
increase (don't forget swap!)
2) shutdown your system and install the new disk as either the secondary 
on the same bus as your current disk or (preferred) the primary disk on 
the secondary bus.
3) reboot your machine, I'd recommend single user mode (add an "s" to 
the boot line at startup)
4) optional - verify all partitions are mounted issue a "/bin/mount -a" 
(mount all)
5) run /sbin/fdisk /dev/sdc (a = primary controller primary disk, b = 
primary controller secondary disk, c = secondary controller primary disk)
6) configure your partitions and make sure you set the type (83 = linux, 
82 = linux swap)
7) format your new partitions with "/sbin/mkfs -t ext3 /dev/hdcX" 
replace X with the partition number (eg /sbin/mkfs -t ext3 /dev/hdc1)
8) format your new swap partition with "/sbin/mkswap /dev/hdcX" again 
replace X with the partition number for swap
9) mount your new partitions, I recommend the following:
a) mkdir /mnt/root
b) mount /dev/sdcX /mnt/root
c) mkdir /mnt/root/boot
d) mount /dev/sdcX /mnt/root/boot
e) mkdir /mnt/root/home
f) mount /dev/sdcX /mnt/root/home
...etc...

10) copy your partitions - dump/restore works very well - but only on an 
idle filesystem it will cause you grief on an active filesystem (so will 
programs like tar)
a) dump -0f - /dev/sdaX | (cd /mnt/root; restore -rf -) - where 
/dev/sdaX is the location of your root filesystem
b) dump -0f - /dev/sdaX | (cd /mnt/root/home; restore -rf - ) - where 
/dev/sdaX is the location of your home filesystem
...etc...

11) Next label your new partitions, otherwise things will break (change 
X to the partition number on the new disk)
a) /sbin/e2label /dev/sdcX /
b) /sbin/e2label /dev/sdcX /boot
c) /sbin/e2label /dev/sdcX /home
...etc...

12) install the boot loader on the new disk use the following command:
/sbin/grub-install --root-directory=/mnt/root --recheck /dev/sdc (if you 
have a separate boot partition use /mnt/root/boot)
note: grub uses the actual disk name /dev/sdc not a partition! (eg NO 
/dev/sda1)

13) shutdown the system
14) remove the old disk
15) install the new disk as primary on the primary controller
16) reboot
17) you can remove file "restoresymtable" which is left behind in the 
top directory of every filesystem by restore if desired

I don't think I missed anything.

*note: after installing the new disk, do not install both the old and 
new disks at the same time, when the system goes to mount the disks it 
checks the label, and finding 2 disks with the same label name may (ok, 
will always) cause it to mount the wrong disk!!!

good luck..

Jeff




More information about the fedora-list mailing list