Re: moving linux partitions

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

 



Gerhard Magnus writes:

What's the best way to move Linux partitions?  I'm running FC4 and need
to move two of them: the main and swap partitions, to a second hard
drive on the same system.  But when I try copying these partitions from
Windows XP using Partition Magic 8 I get an error 510: "The version of
the file system is not supported."  This doesn't make sense to me as
Partition Magic 8 supposedly supports the ext3 file system -- I used it
to create the original partitions in the first place.  (Also this would
be the first time Partition Magic has not been... well, magical.)

If the new partitions will be the same size as the old partitions, then:

* Boot FC4 installer and select rescue mode; or boot the FC4 rescue disk

* Rescue mode automatically mounts your existing partition as /mnt/sysimage. Unmount it.

* Create the partitions on the second hard drive using "fdisk /dev/hdb". If fdisk complains, try "fdisk /dev/hdc", because your new hard drive is on the second IDE channel.

* Double-check your typing, before you run fdisk. If you're off by a letter, your existing hard drive becomes a brick.

* Use 'dd' to copy the data from the old main partition to the new main partition. If your old disk's main partition is /dev/hda1, presumably the second hard drive is going to be /dev/hdb1 (or /dev/hdc1, if the second disk is on the second IDE bus):

dd if=/dev/hda1 of=/dev/hdb1 bs=1M

Again, type carefully. A badly chosen typo, and you've just overwrite your old Linux partition with an empty one.

* Now, mount the new partition, and chroot to it:

mount /dev/hdb1 /mnt/sysimage
chroot /mnt/sysimage

Hopefully you'll now be seeing the mirrored copy of your existing partition. You will now need to edit the new partition's /etc/fstab, and replace the sole reference to /dev/hda1 with /dev/hdb1

* If your FC4 install was originally a fresh install, and not an upgrade from some old version of Fedora, or even RH, your original install probably used labels. This is going to get interesting. Replace the label reference with the actual partition name (since you now have two / partitions). Replace "LABEL=/" with "/dev/hdb1" in /etc/fstab.

* Don't forget to also change the name of the swap partition from "/dev/hda2" to "/dev/hdb2" (presuming your old swap was /dev/hda2). Don't bother copying the swap partition. Just run mkswap to initialize the new swap partition.

* Time to fix grub. Edit /boot/grub/device.map and add an entry for the second hard drive. You'll probably need to append "(hd1) /dev/hdb" (or /dev/hdc, as appropriate). Edit /boot/grub/grub.conf, and replace all references to "(hd0)" with "(hd1)"; also fix the "root" parameter on _every_ kernel line (otherwise you'll end up covertly booting your old partition). Your old kernel arguments probably had "root=/dev/hda1", replace it with "root=/dev/hdb1" (or hdc1). If your old kernel args were "root=LABEL=/", you'll still need to replace it with /dev/hdb1 or /dev/hdc1. Finally run /sbin/grub-install.

* Type "exit" to terminate your chroot session, then "unmount /mnt/sysimage" to unmount the new partition. Cross your fingers, and reboot.

I think that should do it. Bottom line is that a straight partition-partition copy won't be enough. There are a bunch of boot-related references to your existing partitions that also need to be fixed.

Finally, if your new partitions' sizes are different, you'll still need to do mostly the same thing, except that you can't use "dd" to copy the partitions. It's a bit more complicated, and if you have to ask these kinds of questions, I think that it might be a bit more than you can handle for the moment, I'm afraid…


Attachment: pgp7Ag8FxMgsQ.pgp
Description: PGP signature


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux