Solved

Migrating root partition

Posted on 1998-10-15
3
251 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now