I am trying to understand why my attempts to mount DO’s block storage device to docker’s /var/lib/docker
dir results in lost+found
.
First, Terraform is used to provision a digital ocean droplet and attach a volume to it. Then ansible is used to configure the host.
Please note that playbook below is using static/explicit values due to needing to debug:
---
- name: mount point of attached volume
stat:
path: /mnt/name_of_attached_volume
- name: get digital_ocean_volume_path_by_name
stat:
path: /dev/disk/by-id/scsi-0DO_Volume_name_of_attached_volume
- name: unmount images volume
command: umount /mnt/name_of_attached_volume
- name: Label the volume
command: parted -s /dev/disk/by-id/scsi-0DO_Volume_name_of_attached_volume mklabel gpt
- name: Create an ext4 partition
command: parted -s -a opt /dev/disk/by-id/scsi-0DO_Volume__name_of_attached_volume mkpart primary ext4 0% 100%
- name: Build the ext4 metadata
command: mkfs.ext4 /dev/disk/by-id/scsi-0DO_Volume__name_of_attached_volume-part1
####################################################################
# since the mount point -- `/var/lib/docker` -- already exists #
# by virtue of docker being installed on the host, no need to #
# create a mount point but I do need stop docker running #
####################################################################
- name: stop docker service
service:
name: docker
state: stopped
- name: mount volume read-write
mount:
path: /var/lib/docker
src: /dev/disk/by-id/scsi-0DO_Volume__name_of_attached_volume-part1
fstype: ext4
opts: defaults,discard
dump: 0
passno: 2
state: mounted
- name: remove mount point for images volume
command: rmdir /mnt/name_of_attached_volume
- name: Start docker service
service:
name: docker
state: started
enabled: "{{ docker_service_enabled }}"
After running the playbook above, the result of for running ls -la /var/lib/docker is:
drwxr-xr-x 3 root root 4096
drwx--x--x 14 root root 4096
drwx------ 2 root root 16384 Jan 25 16:47 lost+found
**Why is this so? ** I do not believe that the directory should be lost+found.
I am obviously missing/misunderstanding a step. Greatly appreciate tips please. Thank you!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
The lost+found directory is used by file system check tools (fsck). When a system crashes and there is some inconsistency, fsck might be able to (partially) recover lost information (files or directories). It might not know where these files should reside, so it places them in the lost+found directory so that the administrator can move them back to their original location(s).
The lost+found directory is not vital. If the administrator decides to delete it, on the next run of fsck will be recreated.
referenced from: https://wiki.gentoo.org/wiki/Knowledge_Base:What_is_the_lost%2Bfound_directory%3F
Thank you for providing a succinct answer as well as a reference.