Bug#635991: set swap flag for ZVOL swap instead of adding it to fstab
Package: partman-basicfilesystems
Version: 71
Severity: wishlist
Tags: patch
User: debian-bsd@lists.debian.org
Usertags: kfreebsd zfs
This patch makes partman-basicfilesystems set the swap flag for ZVOL
(ZFS volume) swap devices instead of adding them to fstab.
There are two reasons why this is preferred:
- FreeBSD systems (or derivatives like Debian GNU/kFreeBSD) installed in
the same computer will automatically identify this as a swap partition,
and may enable it during their boot process if this flag is present.
This makes it easier to share swap between them.
- The flag may already be present. In this situation, setting it again
has no effect, but adding the device to fstab would make the boot
process attempt to enable the same device twice.
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: kfreebsd-amd64 (x86_64)
Kernel: kFreeBSD 8.2-1-amd64
Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff --git a/fstab.d/basic b/fstab.d/basic
index 1f7e05a..ccfaedf 100755
--- a/fstab.d/basic
+++ b/fstab.d/basic
@@ -27,7 +27,10 @@ for dev in $DEVICES/*; do
[ -f "$id/method" ] || continue
method=$(cat $id/method)
if [ "$method" = swap ]; then
- echo "$path" none swap sw 0 0
+ case "$path" in
+ /dev/zvol/*) zfs set org.freebsd:swap=on ${path#/dev/zvol/} ;;
+ *) echo "$path" none swap sw 0 0 ;;
+ esac
fi
[ -f "$id/acting_filesystem" ] || continue
filesystem=$(cat $id/acting_filesystem)
Reply to: