Hi, Can I set thing that my instance will fsck disk when boot system?
I can not find the tutorials about this
That doesn’t seem to be something LXD related.
However you can configure for which devices fsck
will run during boot using the sixth column in the /etc/fstab
file. There are more details here in the man page of the corresponding systemd-fsckd
service that will trigger those checks on a recent Ubuntu system using systemd: https://www.man7.org/linux/man-pages/man8/systemd-fsck.8.html
thank you, I will try it!
Note: When you run fsck while the PC is open, it will write this message:
The filesystem is mounted. If you continue you WILL cause SEVERE filesystem damage.
Contents of /etc/fstab:
# /etc/fstab: static file system information.
#
# Use ‘blkid’ to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
#
# / was on /dev/sda8 during curtin installation
/dev/disk/by-uuid/05c25a3d-c01c-43ae-a848-9932c64df6fd / ext4 defaults 0 1
# /boot/efi was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/9AAB-377A /boot/efi vfat defaults 0 1
/swap.img none swap sw 0 0
It’s recommended that you don’t do so. Because that’s would be reduandant system checks (which may corrupt the filesystem) When the PC says:
/dev/sdaX: Recovering journal
…
…
…
…
/dev/sdaX: Primary superblock features different from backup. Check forced.
That would be necessary then to do checks.
Hi, I have hundreds of instances in my LXD cluster.
When the host crash, I need to fsck instances on this host manually.
It seems that I can not exec fsck command automatically, because I don’t know the uuid of disk when I build the base image of instance.
I use lxd container instead of virtual machine.
Is there any way to exec fsck command?
When file system of container breakdown, I can not expand instance disk size online successfully.
I need to exec command manually. So I want instance exec fsck before system boot.
sudo rbd map -p lxd container_shpc-168-instance-WvycKBTn
sudo fsck.ext4 -y /dev/rbd0
sudo resize2fs /dev/rbd0
sudo rbd unmap lxd/container_shpc-168-instance-WvycKBTn
rbd showmapped