Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 297
  • Last Modified:

Migrating root partition

I have my root partition in /dev/hdb1 and would like to
move it to a larger disk, /dev/hda2. What are the steps
required to do this and avoid a headache or screwing up
the filesystem?
0
golfsd
Asked:
golfsd
  • 2
1 Solution
 
ghjmCommented:
Assuming that you have /dev/hda2 mounted under /mnt/hda2:

cp --archive --verbose --one-file-system / /mnt/hda2

This will copy recursively, preserving file permissions, ownership, etc, everything on the root mouted filesystem but nothing else (ie no /mnt/cdrom, other mounted drives, or recursive descent into /mnt/hda2 itself) to /mnt/hda2. Then, just edit /etc/lilo.conf to reflect the new root partition, run /sbin/lilo, and reboot. (Make sure you propagate the changes to /etc/lilo.conf to the copy on the new partition, or you'll get a nasty surprise later...)

-Graham
0
 
golfsdAuthor Commented:

This may be obvious, but: Do I need to boot off a floppy
and have my /dev/hdb1 mounted as RO? According to ghjm's
answer, it seems I could "cp" everything, even though
/dev/hbd1 is an open filesystem ... I'm just trying to be
extra-cautious here.
0
 
ghjmCommented:
No, you do not need to boot from a floppy. The only concern is to make sure that you get a consistent file set, i.e. that there weren't any processes writing to files at the time you did the copy. And, of course, So if you're running anything like a database server or whatever, you should probably kill it before you copy. If you want to be extra-paranoid, kill all processes but the bare minimum.

0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now