diff options
author | Andrew Cady <d@jerkface.net> | 2020-10-12 10:44:27 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2020-10-12 10:53:31 -0400 |
commit | 996c430fd798598e1ba4d492741fc2fadf1a3a1e (patch) | |
tree | 3540d1ac5fb54da15234677625911d70715ec2d5 | |
parent | a50c1bc9ef4d152b8f6262ef281c4a0c510db822 (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.
-rw-r--r-- | fsmgr.hs | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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 |