[H-GEN] altering disk partitions
Tony Nugent
tony at linuxworks.com.au
Tue Mar 18 08:28:56 EST 2003
[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]
On Tue Mar 18 2003 at 21:47, Mark Suter wrote:
> Dale,
>
> I suggested "try the symlink solution" but I didn't give any
> details. So, here's an example of moving /usr/share over to
> /home/usr_share and leaving a symlink in its place.
>
> # shutdown now # Goto single-user mode
>
> # mkdir /home/usr_share
> # chown root:root /home/usr_share
> # chmod u=rwx,og=rx /home/usr_share
>
> # cd /usr/share
> # tar cpsSf - . | ( cd /home/usr_share ; tar xpsSf - )
> # cd /usr
> # mv share share.old && ln -s /home/usr_share share
>
> # telinit 2 # Return to the default from /etc/inittab
>
> Once you've confirmed all is well, you can delete all of
> /usr/share.old and get the free space you desire.
There is yet another way to do this, using mount --bind to attach
directories onto mount points.
For example, I have a big /opt/ partition that I use for "extra
space". Space was running low on / so things needed re-arranging.
Because /usr was on the root partition, in the end the simplest
solution was to move /usr/local/ and /usr/src/ to /opt/local/ and
/opt/src/ respectively, then point the two /usr/ directories into
/opt/.
The "redirection" of the /usr/src and /usr/local directories can be
made to work without having to re-create them as symlinks. The
whole relocation process is elegantly simple:
$ cp -ar /usr/src /opt/
$ cp -ar /usr/local /opt/
$ rm -fr /usr/src/* /usr/local/*
$ mount --bind /opt/src /usr/src
$ mount --bind /opt/local /usr/local
So the directory heirachy in /opt/src gets mounted onto /usr/src/
(and /opt/local onto /usr/local/). btw, if I need more room then
/usr/share will be next to end up in /opt/ :)
The magic in /etc/fstab to make it permanent looks like this:
/opt/src /usr/src auto bind,defaults 0 0
/opt/local /usr/local auto bind,defaults 0 0
Just make sure that the all the partitions with these mount points
have been previously mounted (ie, put these bind entries near the
end of the file).
It's very cool... because they are mounted as filesystems, when you
use tools like /bin/df you'll get the contents of the /opt/src (as
/usr/src) and /opt/local (as /usr/local) directory trees included in
the usage summary totals. One of the (few) downsides is that tools
like (s)locate/updatedb will happily record the presence of the same
file in both /usr/src/ and /opt/src. (no biggie, probably
tweakable).
> Yours sincerely,
>
> - -- Mark John Suter | I know that you believe you understand
Cheers
Tony
--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'. See http://www.humbug.org.au/
More information about the General
mailing list