moving /usr directory

Reuben D. Budiardja techlist at voyager.phys.utk.edu
Tue Oct 12 22:09:28 UTC 2004


On Tuesday 12 October 2004 14:34, Jeff wrote:
> Hi All,
>
> Is there a quick and easy way to move a main OS directory (im thinking /usr
> since its taking up most of the space - ~900MB) to a different drive
> without any hassle. At the moment all but /home are on hda2 but this disk
> is almost full. Ive already got another drive installed with plenty of free
> space (hdc). I suspect this will cause problems but thought its worth
> asking.

Assuming hdc is installaed and partitioned (hdc1) as ext3, mounted in 
/mnt/new_usr you can just do this. 
1. Go to runlevel 1. 
$> init 1

2. Copy the content of /usr
$> cp -a /usr/* /mnt/new_usr/

3. Edit fstab to mount /usr automatically next boot, and include
/dev/hdc1               /usr                    ext3    defaults        1 1

4. Reboot

After reboot, if you do "df -h" it will shows that /usr is mounted /dev/hdc1. 
Now if you sure everything works correctly, you can go back to init1, umount 
/usr, this will then show you the old /usr, not the one in /dev/hdc1, and 
remove everything: "rm -rf /usr/*" so that you have more space in your 
/dev/hda2. Be Careful !!!!
Then mount /usr/ back.

I've done this before, and I had no problem. But the disclaimer is, don't 
blame me if something goes wrong !! :)

RDB

-- 
Reuben D. Budiardja
Dept. Physics and Astronomy
University of Tennesse, Knoxville, TN

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GIT/M/MU/P/S d-(++) s: a-- C++(+++) UL++++ P-- L+++>++++ E- W+++ 
N+ o? K- w--- !O M- V? !PS !PE Y PGP- t+ 5 X R- tv+ 
b++>+++ DI D(+) G e++>++++ h+(*) r++ y->++++
------END GEEK CODE BLOCK------




More information about the redhat-list mailing list