Solved

Migrating root partition

Posted on 1998-10-15
3
261 Views
Last Modified: 2010-04-20
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
Comment
Question by:golfsd
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
ghjm earned 40 total points
ID: 1638279
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
 

Author Comment

by:golfsd
ID: 1638280

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
 
LVL 1

Expert Comment

by:ghjm
ID: 1638281
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question