From 5c19a756032e0a6cff22e1f97b88fa72da447e2e Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Mon, 28 Mar 2022 20:10:13 -0500 Subject: [PATCH] publish: Upload rootfs image atomically Using `--no-W` (disable whole file transfer) saves some time and bandwidth when uploading the root filesystem image, but it has the negative side-effect of overwriting the destination file in place. If any NBD clients are currently running using the image as their root filesystem, they are likely to experience SquashFS corruption errors, as the filesystem driver does not expect the underlying data to change once it has been mounted. As such, we have to use the default file transfer method to create a new file and atomically replace the old file once the transfer is complete. The original file will be unlinked and will eventually be deleted once no clients are using it. --- publish.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish.sh b/publish.sh index 3d16903..02d59e3 100644 --- a/publish.sh +++ b/publish.sh @@ -10,6 +10,6 @@ rsync -rtliO --chmod=a=rwX \ "${bootdir}"/initramfs.img \ "${bootdir}"/vmlinuz \ pxe0.pyrocufflink.blue:/var/lib/tftpboot/basementhud/ -rsync -ti --chmod=a=rwX --no-W \ +rsync -ti --chmod=a=rwX \ "${bootdir}"/basementhud.squashfs \ pxe0.pyrocufflink.blue:/var/lib/nbd/basementhud.squashfs