Skip to content

Commit

Permalink
fix(overlayfs): to allow overlay on top of network device (nfs)
Browse files Browse the repository at this point in the history
Execute mount-overlayfs later in the boot process as a pre-pivot
hook. The existing mount hook is skipped for network boot.

Without this change
`dracut  -a "overlayfs nfs"`
would not work as expected.

Improved the existing test case to test for this scenario.
  • Loading branch information
LaszloGombos committed Mar 30, 2023
1 parent c9da03b commit 5bcd844
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules.d/90overlayfs/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ installkernel() {
}

install() {
inst_hook mount 01 "$moddir/mount-overlayfs.sh"
inst_hook mount 01 "$moddir/mount-overlayfs.sh" # overlay on top of block device
inst_hook pre-pivot 10 "$moddir/mount-overlayfs.sh" # overlay on top of network device (e.g. nfs)
}
7 changes: 7 additions & 0 deletions test/TEST-20-NFS/client-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ while read -r dev _ fstype opts rest || [ -n "$dev" ]; do
break
done < /proc/mounts

# fail the test of rd.live.overlay did not worked as expected
if grep -qF 'rd.live.overlay' /proc/cmdline; then
if ! strstr "$(cat /proc/mounts)" LiveOS_rootfs; then
echo "nfs-FAIL" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
fi
fi

if [ "$fstype" = "nfs" -o "$fstype" = "nfs4" ]; then

serverip=${dev%:*}
Expand Down

0 comments on commit 5bcd844

Please sign in to comment.