I run sudo mksquashfs /usr /usr_squash/usr.sfs -b 65536 -comp xz

I add to fstab:

/usr_squash/usr.sfs                      /usr_squash/sq   squashfs        loop,ro        0    0
overlay                                  /usr        overlay         defaults,lowerdir=/usr_squash/sq,upperdir=/usr_squash/upd,workdir=/usr_squash/tmp   0   0

Of course, mount points sq, upd and tmp are created, too.

With default kernel, I have the following error: failed: No such device which is, obviously, because overlayfs is a kernel [M]odule, not a [*].

With a custom kernel, overlayfs starts but produces the following error:

overlayfs: failed to resolve '/usr_squash/upd': -2
mount: mounting overlay on /root/usr failed: No such file or directory
overlayfs: upper fs is r/o, try multi-lower layers mount

Setting the directory relative to Initial Ramdrive root, not the main root (upperdir=/root/usr_squash/upd instead of upperdir=/usr_squash/upd) does not help. And even if, I can't rebuild a custom kernel on every update.

So, what's the best way to mount compressed /usr? I don't want to break the auto-update, and I don't want auto-update break my system. Should I write a custom hook and run update-initramfs -u -k all? But how?

  • If one feels I said something wrong, blame my English, not my attitude :-/ – NickDoom Feb 22 '19 at 20:34
  • Don't worry, you didn't do anything wrong. It's just that another user found that last sentence a bit aggressive, so I removed it. But no big deal at all. Welcome to the site! – terdon Feb 22 '19 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.