Setting up additional mount points in freeBSD

chris (2006-05-02 17:46:58)
1544 views
0 replies
It would be useful to mount linux devices on the ext2 filesystem into the new tree in FreeBSD. It turns out this isn't too difficult. First I used ls to show the various drives and slices availble:
brezhnev# ls /dev/ad*
/dev/ad0        /dev/ad0s1a     /dev/ad0s1c     /dev/ad0s1e     /dev/ad1s1      /dev/ad3s1
/dev/ad0s1      /dev/ad0s1b     /dev/ad0s1d     /dev/ad1        /dev/ad3

and then using mount to show what's already in use:
brezhnev# mount
/dev/ad0s1a on / (ufs, local)
devfs on /dev (devfs, local)
/dev/ad0s1e on /home (ufs, local, soft-updates)
/dev/ad0s1d on /usr (ufs, local, soft-updates)

So ad0 is take up with the base OS installation, which means that ad1 and ad3 must be the other two spare drives. One of them is a 60GB stack of empty platters (mmm) and the other is 40GB of CVS and project goodness (as yet unmounted).

Just running mount as you might on a linux system isn't too friendly with ext2. Here's what happens:
brezhnev# mkdir opt
brezhnev# mount /dev/ad3s1 /opt
mount: /dev/ad3s1 on /opt: incorrect super block

even if you specify the fs type, things aren't exactly pretty. The reason for this is that freeBSD comes with a suite of varients of the mount command designed for the different filesystems in question. So here's how to mount that big 60G device into /opt in a freeBSD stylie:

brezhnev# /sbin/mount_ext2fs /dev/ad3s1 /opt

Now, to make this persist and survive a reboot all we need to do is add entries to /etc/fstab. Here's what mine looks like after I have added these two new drives:
brezhnev# cat /etc/fstab
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/ad0s1b             none            swap    sw              0       0
/dev/ad0s1a             /               ufs     rw              1       1
/dev/ad0s1e             /home           ufs     rw              2       2
/dev/ad0s1d             /usr            ufs     rw              2       2
/dev/acd0               /cdrom          cd9660  ro,noauto       0       0
/dev/ad1s1              /share          ext2fs  rw              1       1
/dev/ad3s1              /opt            ext2fs  rw              1       1

so now we just need to reboot and this is what we see in the console with df -h:
brezhnev# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ad0s1a    2.3G     71M    2.1G     3%    /
devfs          1.0K    1.0K      0B   100%    /dev
/dev/ad0s1e     32G     42K     29G     0%    /home
/dev/ad0s1d    2.3G    1.9G    202M    91%    /usr
/dev/ad1s1      38G     34G    1.8G    95%    /share
/dev/ad3s1      56G    4.0K     54G     0%    /opt

Looks great - altho I'm not sure wny 4GB are reported as used. Might be a good time to try fdisk on that device, switch it over to ufs (freeBSD's native filesystem) and retreive that space...

christo
comment