[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: idiots guide to re-arranging directory mount points



Martin Waller hat gesagt: // Martin Waller wrote:

> I've come into an extra 2GB hard drive for one of my debian systems - I 
> currently have a ~1GB drive and a ~0.5 GB drive, with swap and \usr on 
> their own partitions (I think /usr is on the 1GB drive).
> 
> As I'm adding another 2GB, how can I rearrange the mount points for /usr 
> easily?  It'd be nice to have have /usr on the 2GB drive, and perhaps 
> /usr/local on the 6500 hard drive.
> 
> Is this possible, and how in a 'simple' way?

[I would not bother making /usr/local a separate partition. Debian has so
much software, I nearly don't use /usr/local at all.]

Just partition your hard drives the way you like and make the linux
filesystems with /sbin/mke2fs.

Then you should go to single user mode (just in case) with:
$ telinit 1

Then mount your targeted new usr-partition somewhere, e.g 
$ mkdir /mnt/usr-new
$ mount -t ext2 /dev/YOUR_NEW_HARDDISK  /mnt/usr-new
                       ^ replace with the correct device

Now copy everything from /usr to /mnt/usr-new
There are different ways to copy the whole partition. I prefer this:

$ cp -ax /usr/* /mnt/usr-new/

Check if everything has been copied. You can test this by unmounting
/usr and /mnt/usr-new and re-mounting the partition that had been
mounted under /mnt/usr-new under /usr:
$ mount -t ext2 /dev/YOUR_NEW_HARDDISK  /usr

Your system should now behave like before. If everything is working
correctly it is time to change /etc/fstab to reflect your moved
/usr-partition.

Change the line with /usr in it to:
/dev/YOUR_NEW_HARDDISK  /usr    ext2    defaults    0       2

Then it can be mounted with 
$ mount -a

Reboot!

If all is working you can now delete you old /usr-partition.

P.S.: Some caveats: If you change the location of your old harddrive (first or
second IDE-port etc.), there will be some configuration to do in /etc/fstab. 
If so, then do all this first, and copy /usr afterwards.
-- 
                                                     __    __
 Frank Barknecht           ____ ______   ____ __ trip\ \  / /wire ______
                          / __// __  /__/ __// // __  \ \/ /  __ \\  ___\	
                         / /  / ____/  / /  / // ____// /\ \\  ___\\____ \	
                        /_/  /_____/  /_/  /_//_____// /  \ \\_____\\_____\
                                                    /_/    \_\ 


Reply to: