summaryrefslogtreecommitdiff
path: root/fsmgr.hs
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2020-10-12 10:44:27 -0400
committerAndrew Cady <d@jerkface.net>2020-10-12 10:53:31 -0400
commit996c430fd798598e1ba4d492741fc2fadf1a3a1e (patch)
tree3540d1ac5fb54da15234677625911d70715ec2d5 /fsmgr.hs
parenta50c1bc9ef4d152b8f6262ef281c4a0c510db822 (diff)
Change btfrs uuid all the time
This is a workaround for a kernel bug that happens when you try to mount the image file after creating it with cp. It acts as if the same UUID is already mounted, even though it isn't (anymore). Changing the UUID on the image allows mounting it. Can't use 'btrfstune -m' here because (for the time being) it doesn't work on seed images. So that means that the operation is slow. It is done more than necessary because it is done wherever made necessary by existing code. TODO: Change the actual behavior of the program to wait until the very end to set seed property. Only set -S1 when creating the patchfs or creating the uplevel image.
Diffstat (limited to 'fsmgr.hs')
-rw-r--r--fsmgr.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/fsmgr.hs b/fsmgr.hs
index d8e1c1d..bd4e303 100644
--- a/fsmgr.hs
+++ b/fsmgr.hs
@@ -229,6 +229,7 @@ buildInitialImage DiskImageConfig{..} mountpoint out = do
229 need [parent] 229 need [parent]
230 cmd_ "cp --reflink" [parent, out] 230 cmd_ "cp --reflink" [parent, out]
231 cmd_ "btrfstune -f -S0" [out] 231 cmd_ "btrfstune -f -S0" [out]
232 cmd_ "btrfstune -fu" [out]
232 cmd_ "mkdir -p" [mountpoint] 233 cmd_ "mkdir -p" [mountpoint]
233 cmd_ "sh -c" ["if [ -e \"$0\" ]; then cp \"$0\" \"$1\"; fi", parent <.> "devices.txt", out -<.> "devices.txt"] 234 cmd_ "sh -c" ["if [ -e \"$0\" ]; then cp \"$0\" \"$1\"; fi", parent <.> "devices.txt", out -<.> "devices.txt"]
234 235
@@ -380,7 +381,8 @@ chrootImage target args =
380 let mnt = tmp <.> "mnt" 381 let mnt = tmp <.> "mnt"
381 orderOnly [inp] 382 orderOnly [inp]
382 cmd_ "cp --reflink=always" [inp, tmp] 383 cmd_ "cp --reflink=always" [inp, tmp]
383 cmd_ "btrfstune -S0 -f" tmp 384 cmd_ "btrfstune -S0 -f" [tmp]
385 cmd_ "btrfstune -fu" [tmp]
384 cmd_ "mkdir" [mnt] 386 cmd_ "mkdir" [mnt]
385 387
386 setupLoopDevices target 388 setupLoopDevices target