unix/fiss-linux

etc/start.d/03-filesystems.sh in master
Repositories | Summary | Log | Files | LICENSE

03-filesystems.sh (2150B) download


 1# vim: set ts=4 sw=4 et:
 2
 3[ -n "$VIRTUALIZATION" ] && return 0
 4
 5msg "Remounting rootfs read-only..."
 6mount -o remount,ro / || emergency_shell
 7
 8if [ -x /sbin/dmraid -o -x /bin/dmraid ]; then
 9    msg "Activating dmraid devices..."
10    dmraid -i -ay
11fi
12
13if [ -x /bin/mdadm ]; then
14    msg "Activating software RAID arrays..."
15    mdadm -As
16fi
17
18if [ -x /bin/btrfs ]; then
19    msg "Activating btrfs devices..."
20    btrfs device scan || emergency_shell
21fi
22
23if [ -x /sbin/vgchange -o -x /bin/vgchange ]; then
24    msg "Activating LVM devices..."
25    vgchange --sysinit -a ay || emergency_shell
26fi
27
28if [ -e /etc/crypttab ]; then
29    msg "Activating encrypted devices..."
30    awk -f /usr/share/fiss/crypt.awk /etc/crypttab
31
32    if [ -x /sbin/vgchange -o -x /bin/vgchange ]; then
33        msg "Activating LVM devices for dm-crypt..."
34        vgchange --sysinit -a ay || emergency_shell
35    fi
36fi
37
38if [ -x /usr/bin/zpool -a -x /usr/bin/zfs ]; then
39    if [ -e /etc/zfs/zpool.cache ]; then
40        msg "Importing cached ZFS pools..."
41        zpool import -N -a -c /etc/zfs/zpool.cache
42    else
43        msg "Scanning for and importing ZFS pools..."
44        zpool import -N -a -o cachefile=none
45    fi
46
47    msg "Mounting ZFS file systems..."
48    zfs mount -a -l
49
50    msg "Sharing ZFS file systems..."
51    zfs share -a
52
53    # NOTE(dh): ZFS has ZVOLs, block devices on top of storage pools.
54    # In theory, it would be possible to use these as devices in
55    # dmraid, btrfs, LVM and so on. In practice it's unlikely that
56    # anybody is doing that, so we aren't supporting it for now.
57fi
58
59[ -f /fastboot ] && FASTBOOT=1
60[ -f /forcefsck ] && FORCEFSCK="-f"
61for arg in $(cat /proc/cmdline); do
62    case $arg in
63        fastboot) FASTBOOT=1;;
64        forcefsck) FORCEFSCK="-f";;
65    esac
66done
67
68if [ -z "$FASTBOOT" ]; then
69    msg "Checking filesystems:"
70    fsck -A -T -a -t noopts=_netdev $FORCEFSCK
71    if [ $? -gt 1 ]; then
72        emergency_shell
73    fi
74fi
75
76msg "Mounting rootfs read-write..."
77mount -o remount,rw / || emergency_shell
78
79msg "Mounting all non-network filesystems..."
80mount -a -t "nosysfs,nonfs,nonfs4,nosmbfs,nocifs" -O no_netdev || emergency_shell