Revision 91d8c6c9
Added by Christian McDonald about 3 years ago
src/etc/rc.ramdisk_functions.sh | ||
---|---|---|
26 | 26 |
RAMDISK_DEFAULT_SIZE_tmp=40 |
27 | 27 |
RAMDISK_DEFAULT_SIZE_var=60 |
28 | 28 |
|
29 |
# Replacement for /etc/rc.d/zfsbe onestart |
|
30 |
_be_remount_ds() { |
|
31 |
local _dataset="${1}" |
|
32 |
|
|
33 |
/sbin/zfs list -rH -o mountpoint,name,canmount,mounted -s mountpoint -t filesystem "${_dataset}" | \ |
|
34 |
while read _mp _name _canmount _mounted ; do |
|
35 |
# skip filesystems that must *not* be mounted |
|
36 |
[ "${_canmount}" = "off" -o "${_mp}" = "/" ] && continue |
|
37 |
# unmount the dataset if mounted... |
|
38 |
[ "$_mounted" = "yes" ] && /sbin/umount -f "${_name}" |
|
39 |
# mount the dataset |
|
40 |
/sbin/zfs mount "${_name}" |
|
41 |
done |
|
42 |
} |
|
43 |
|
|
44 |
# Replacement for /etc/rc.d/zfsbe onestart |
|
45 |
_be_mount_zfs() { |
|
46 |
echo -n "Mounting ZFS boot environment..." |
|
47 |
/sbin/mount -p | while read _dev _mp _type _rest; do |
|
48 |
[ "${_mp}" = "/" ] || continue |
|
49 |
if [ "${_type}" = "zfs" ] ; then |
|
50 |
_be_remount_ds "${_dev}" |
|
51 |
fi |
|
52 |
break |
|
53 |
done |
|
54 |
echo " done." |
|
55 |
} |
|
56 |
|
|
57 | 29 |
# Check if RAM disks are enabled in config.xml |
58 | 30 |
ramdisk_check_enabled () { |
59 | 31 |
[ "$(/usr/local/sbin/read_xml_tag.sh boolean system/use_mfs_tmpvar)" = "true" ] |
... | ... | |
216 | 188 |
fi |
217 | 189 |
} |
218 | 190 |
|
219 |
# Unmounts parent and subordinate datasets |
|
220 |
ramdisk_zfs_deep_unmount() { |
|
221 |
local _path="${1}" |
|
222 |
|
|
223 |
/sbin/zfs list -rH -o name,mountpoint -S mountpoint -t filesystem "${_path}" | \ |
|
224 |
while read _name _mp; do |
|
225 |
echo -n "Unmounting ZFS volume ${_name} at ${_mp} for RAM disk..." |
|
226 |
/sbin/zfs unmount -f "${_name}" 1>/dev/null 2>&1 |
|
227 |
echo " done." |
|
228 |
done |
|
229 |
} |
|
230 |
|
|
231 |
# Mounts ZFS datasets and BE datasets |
|
232 |
ramdisk_fixup_zfs_mount() { |
|
233 |
echo -n "Mounting ZFS volumes..." |
|
234 |
/sbin/zfs mount -a 1>/dev/null 2>&1 |
|
235 |
_be_mount_zfs |
|
236 |
echo " done." |
|
237 |
} |
|
238 |
|
|
239 |
# Unmounts ZFS datasets and remounts BE datasets |
|
240 |
ramdisk_fixup_zfs_unmount() { |
|
241 |
ramdisk_zfs_deep_unmount "/tmp" |
|
242 |
ramdisk_zfs_deep_unmount "/var" |
|
243 |
_be_mount_zfs |
|
191 |
# Either unmount or mount /var and /tmp in ZFS as needed to avoid conflicts with |
|
192 |
# active RAM disk options. |
|
193 |
ramdisk_fixup_zfs () { |
|
194 |
# Mount /var and /tmp on ZFS filesystems when necessary |
|
195 |
if [ ${1} = "mount" ]; then |
|
196 |
echo "Remounting ZFS volumes" |
|
197 |
zfs mount -a |
|
198 |
else |
|
199 |
zfs list -H -o name,mountpoint | |
|
200 |
while read volume mountpoint; do |
|
201 |
[ "${mountpoint}" != "/var" -a "${mountpoint}" != "/tmp" ] \ |
|
202 |
&& continue |
|
203 |
echo "Dismounting ZFS volume ${volume} for RAM disk" |
|
204 |
/sbin/zfs umount ${volume} |
|
205 |
done |
|
206 |
fi |
|
244 | 207 |
} |
Also available in: Unified diff
Revert "Fixes RAM disk handling on ZFS (support boot environments)"
This reverts commit e6b47d6812b1a46738c75a8991cd1393b200d7ef