LoginSignup
2
2

More than 5 years have passed since last update.

Cent OS 7 の docker を overlay 対応させる方法

Last updated at Posted at 2018-06-20

cent で ftype=1 のdiskを /var/lib/docker にマウントする方法

fedora系はdocker のoverlay対応がいまいち。原因はdisk formatがいまいち。このせいでどうでもいいハマりがなくならない。

Use the OverlayFS storage driver | Docker Documentation

xfs (RHEL 7.2 and higher), but only with d_type=true enabled. Use xfs_info to verify that the ftype option is set to 1. To format an xfs filesystem correctly, use the flag -n ftype=1.

いろいろ調べると、cent installerは ftype=1 のフォーマットができないので /var/lib/docker にだけ違うパーティションを作るのがいいらしい。

docker 的には d_type = true で redhat的には ftype=1 らしい。同じものを示すらしい。

  1. ESXi(virtual boxとか) で全パーティション合計容量のハードディスクを1つマウントしたVMを用意
  2. cent installerでパーティション自分で作るを選ぶ
  3. 自動生成を選んで /, /boot, /swap を作ってもらう
  4. / の容量を減らす
  5. パーティションを追加して /var/lib/docker を作る(残り容量が勝手に当たる)
    1. このやり方だと / も /var/lib/docker もlvmになるので後から追加可能になる
  6. os install
  7. 起動したら /var/lib/docker をフォーマットし直す
   df -hT
   umount /var/lib/docker
   mkfs.xfs -f -n ftype=1 /dev/centos/var_lib_docker 
   mount -a
   df -hT
   xfs_info /var/lib/docker/ | grep ftype=1

参考

https://docs.docker.com/storage/storagedriver/overlayfs-driver/

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/7.2_release_notes/technology-preview-file_systems

http://man7.org/linux/man-pages/man8/mkfs.xfs.8.html

https://superuser.com/questions/1321926/recreating-an-xfs-file-system-with-ftype-1

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2