Can I config an instance auto exec fsck command when it start
Required information
- Distribution: LXC
- Distribution version: 5.16
- The output of "lxc info" or if that fails:
- Kernel version: 5.19.11-051911-generic
- LXC version: "5.16"
- Storage backend in use: ceph 17.2.5
Issue description
Hello, can I set thing that my container instance will exec fsck disk when boot system? When file system of container breakdown (it happend after host crash usually), I can not expand instance disk size online successfully. I need to exec command manually like this:
sudo rbd map -p lxd container_xxx
sudo fsck.ext4 -y /dev/rbd0
sudo resize2fs /dev/rbd0
sudo rbd unmap lxd/container_xxx
rbd showmapped
So I want container instance and exec fsck command before system boot. 👀
This sounds like an interesting idea, ive flagged it as a new feature as its not something we support currently.
Thanks!
Thank you, tomponline! Waiting for your great work.
Now I try to exec fsck command by my app before calling lxd start container http api, but I think it is a clumsy design. 😁
Going with a fully automated repair (attempt) with fsck.ext4 -y feels risky. Personally I'd only do that after taking a snapshot if I care about the data.
I think that prompting the user on what to do if fsck.ext4 -n returns non-zero would be safer. Alternatively, fsck.ext4 -p might be considered as it repairs "what can be safely fixed without human intervention".
@simondeziel hi, can lxd exec fsck.ext4 -p automatically?
@equator8848 not currently but as Tom said, it an idea worth looking into.