Skip to content

Commit

Permalink
Merge pull request #338 from mboisson/smarter_umount_prepare4image.sh
Browse files Browse the repository at this point in the history
Smarter umount in prepare4image.sh
  • Loading branch information
cmd-ntrf authored May 15, 2024
2 parents 19d2898 + 6c8c284 commit 9cf6358
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions site/profile/files/base/prepare4image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ rm /opt/consul/node-id /opt/consul/checkpoint-signature /opt/consul/serf/local.s
swapoff -a
grep -q "swap" /etc/fstab && rm -f $(grep "swap" /etc/fstab | cut -f 1)
# Unmount filesystems
grep -v -P '(ext4|xfs|vfat|swap|^#|^$)' /etc/fstab | cut -f 2 | xargs umount
grep -P '(ext4|xfs|vfat|^#|^$)' /etc/fstab > /etc/fstab.new
umount -a --types cephfs,nfs4
# for xfs, we unmount only what's in /mnt, not things like / or /boot
grep xfs /etc/fstab | cut -f 2 | grep /mnt | xargs umount
grep -P '(ext4|xfs|vfat|^#|^$)' /etc/fstab | grep -v /mnt > /etc/fstab.new
mv -f /etc/fstab.new /etc/fstab
systemctl daemon-reload

Expand Down Expand Up @@ -56,4 +58,4 @@ TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=dhcp
EOF
halt -p
halt -p

0 comments on commit 9cf6358

Please sign in to comment.