Author Topic: moving linux  (Read 444 times)

shuiend

  • Member
  • **
  • Posts: 250
  • Kudos: 0
    • http://stuff4fools.topcities.com
moving linux
« on: 11 September 2002, 05:15 »
is it possible to move the whole linux partition to another partition? i have red hat set up right now how i want it and i want to move it to my other harddrive which has a bigger partition for it. Is it possible?

And i cannot just reinstall red hat b/c i am not sure how i got the wireless working and when i tried it did not work.
you know its a bad day when you look more sober then usual

TheQuirk

  • VIP
  • Member
  • ***
  • Posts: 2,154
  • Kudos: 315
moving linux
« Reply #1 on: 11 September 2002, 06:38 »
Erm.. Wouldn't making a partion using fdisk then doing

$ mke2fs -j  -T news /dev/hdb2
then
$ mount /dev/hdb2 /mnt/second_hd
then
$cp -r / /mnt/second_hd

then updating Lilo work? Actually, it probably wouldn't work. Just because I already wrote this..

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
moving linux
« Reply #2 on: 11 September 2002, 07:29 »
You need to make sure permissions and ownership are transferred properly along with devices, and you don't want to copy things like "/proc". Now the easiest way might be to create the new partition (using Linux fdisk)  larger than the parition that you want to duplicate and boot from an alternate boot source (rescue disk, Tom's boot disk, knoppix CD etc), then dd the old partition to the new partition:

# dd if=/dev/hda1 of=/dev/hdb1

Then mount "/dev/hdb1" and change the "etc/fstab" to reflect the new partition device names, and you'll also have to update your boot loader to boot the new device name.

Once booted up you can use "resize2fs" command to enlarge the file system.

Having said that, you should also be able to use the "cp" method as TheQuirk mentioned above but you would want to use the "-a" switch instead of the "-r" switch, and you don't want to copy "/proc".  It should work (but you also must be root obviously). Both ways are probably an equal amount of work and I would recommend that on either method you boot from an alternate boot disk to do the copy or dd. That will ensure no files are being changed during the copy.

[ September 10, 2002: Message edited by: void main ]

Someone please remove this account. Thanks...