From 8fc47083778885bd5585647e9a269d65b51ca544 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sun, 17 Jun 2012 22:53:46 -0400 Subject: [PATCH] genfstab: handle bind mounts --- genfstab | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/genfstab b/genfstab index b8405a4..920eda5 100755 --- a/genfstab +++ b/genfstab @@ -79,7 +79,7 @@ if (( bylabel && byuuid )); then fi # handle block devices -findmnt -Recvruno SOURCE,TARGET,FSTYPE,VFS-OPTIONS "$root" | +findmnt -Recruno SOURCE,TARGET,FSTYPE,OPTIONS "$root" | while read -r source target fstype opts; do # default 5th and 6th columns dump=0 pass=2 @@ -96,6 +96,12 @@ findmnt -Recvruno SOURCE,TARGET,FSTYPE,VFS-OPTIONS "$root" | pass=0 fi + if [[ $source =~ ^(/.+)\[(.+)\]$ ]]; then + # it's a bind mount + source=$(findmnt -funcrevo TARGET "${BASH_REMATCH[1]}")${BASH_REMATCH[2]} + fstype=bind + fi + # write one line write_source "$source" printf '\t%-10s' "$target" "$fstype" "$opts"