Re-use disk Space?

cpghost cpghost at cordula.ws
Tue Sep 13 07:23:21 PDT 2005


On Tue, Sep 13, 2005 at 10:04:48AM -0400, Daniel Gonzalez wrote:
> My /usr partiton is almost at capacity (90%) on a separate disk
> (/dev/ad1) from the rest of the other partitons. I allocated way too
> much space for my /music partition (dev/ad0s1f). I don't plan on ever
> using up the 4.1GB that's left over. I've been archiving (to CD) my
> mp3s, oggs etc so I always have a backup. What I wanted to know is
> would it be possible to reclaim some disk space under the /music
> partion and link a /usr sub-partition (/usr/home) to that reclaimed
> space? Hopefully I've explained myself clearly. What part of the
> handbook sections could I start with?

You could e.g. use md(4). Just create a big file (say: /music/usr_home.data)
and create a file system on it:

### Do this only one:
# setenv SIZE_IN_MB 300
# dd if=/dev/zero of=/music/usr_home.data bs=1024k count=${SIZE_IN_MB}
# mdconfig -a -t vnode -f /music/usr_home.data
md0
# newfs /dev/md0
# mount /dev/md0 /usr/home

### Do this every time you reboot:
# mdconfig -a -t vnode -f /music/usr_home.data
# mount /dev/md0 /usr/home

### Do this before shutting down:
# umount /usr/home
# mdconfig -d -u md0

If you want, you can also encrypt /dev/md0 with gbde(1) before
creating a filesystem on it; something like this:

### Do this only one:
# setenv SIZE_IN_MB 300
# dd if=/dev/zero of=/music/usr_home.data bs=1024k count=${SIZE_IN_MB}
# mdconfig -a -t vnode -f /music/usr_home.data
md0
# gbde init /dev/md0 -L /etc/usr_home.lock
Passphrase: .....
# gbde attach /dev/md0 -l /etc/usr_home.lock
Passpharse: .....
# newfs /dev/md0.bde
# mount /dev/md0.bde /usr/home

### Do this every time you reboot:
# mdconfig -a -t vnode -f /music/usr_home.data
md0
# gbde attach /dev/md0 -l /etc/usr_home.lock
Passphrase: .....
# mount /dev/md0.bde /usr/home

### Do this before shutting down:
# umount /usr/home
# gbde detach /dev/md0
# mdconfig -d -u md0

> Dan Gonzalez
> spammesilly at gmail.com
> AOL IM: signulth
> Google Talk: spammesilly

Regards,
-cpghost.

-- 
Cordula's Web. http://www.cordula.ws/


More information about the freebsd-questions mailing list