You are currently browsing the archives for 17 January 2011.
Displaying 1 entry.

/etc/fstab and bind-mount

  • Posted on January 17, 2011 at 03:22

I use a Software RAID0 for data
And on this software-raid-volume, there are my MySQL-Databases, /home and other stuff that should be fast…
And, like all volumes, this software-raid-volume is mounted during boot-time.
But since my /home is also on that volume, it should be mounted using a bind-mount.
So first there is a mount using a mdadm: /dev/md127 -> /mnt/data,
And second there is a mount using bind-mount /mnt/data/home -> /home

It took me quite a while to figure out how to get this done at boot-time, but I managed!
Here’s what my /etc/fstab looks like:

# /etc/fstab: static file system information.
#
# noatime turns off atimes for increased performance (atimes normally aren't
# needed; notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.


# <fs>            <mountpoint>    <type>        <opts>        <dump/pass>


# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
LABEL=boot        /boot        ext2        noauto        1 2
#/dev/sda3        /boot        ext2        noauto        1 2


LABEL=root        /        ext3        defaults    0 1
#/dev/sda4        /        ext3        noatime        0 1

# DATA
LABEL=data        /mnt/data    ext3        defaults    0 1

# HOME (bindmount)
/mnt/data/home         /home        bind        defaults,bind    0 0


# SWAP like RAID0. The higher the value the higher the priority. (max=32767)
/dev/sda5        none        swap        sw,pri=1    0 0
/dev/sdb5        none        swap        sw.pri=1    0 0

#/dev/cdrom        /mnt/cdrom    auto        noauto,ro    0 0
#/dev/fd0        /mnt/floppy    auto        noauto        0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
# POSIX shared memory (shm_open, shm_unlink).
# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
#  use almost no memory if not populated with files)
shm            /dev/shm    tmpfs        nodev,nosuid,noexec    0 0
proc            /proc        proc        defaults        0 0

For the attentive readers:
Yes, I did put my boot on a separate partition. And getting this done on a PowerMac G5 is quite an exhibition! Maybe someday, someday I’m gonna blog about that too!