Skip to content

Latest commit

 

History

History
70 lines (48 loc) · 1.51 KB

docker-xfs.md

File metadata and controls

70 lines (48 loc) · 1.51 KB

XFS filesystem for Docker

  1. Install the necessary packages:
sudo apt-get update
sudo apt-get install xfsprogs
  1. Identify the disk or partition you want to use for the new filesystem. You can use the lsblk or fdisk -l command to list the available disks and partitions. Make sure you select the correct one as this process will erase all data on it.

  2. If the partition you want to use is not formatted, format it with an XFS filesystem. Replace /dev/sdX with the appropriate device identifier:

sudo mkfs.xfs /dev/sdX
  1. Once the partition is formatted, create a mount point. This will be the directory where the new filesystem will be mounted:
sudo mkdir /mnt/docker
  1. Update the /etc/fstab file to automatically mount the new filesystem at boot:
/dev/sdX  /mnt/docker  xfs  defaults,nofail,discard,noatime,quota,prjquota,pquota,gquota  0 2
  1. Mount the new filesystem and verify that it is working:
sudo mount -a
df -h

The output of df -h should show the new filesystem mounted at /mnt/docker.

  1. Stop the docker daemon:
systemctl stop docker
  1. Update the /etc/docker/daemon.json file to point docker to the new mount point:
{
    "data-root": "/mnt/docker"
}
  1. Start the docker daemon:
systemctl start docker
  1. Build the images:
su - codapi
make images
  1. Verify that docker can now limit the storage size:
docker run -it --storage-opt size=16m codapi/alpine /bin/df -h | grep overlay