Upgrade to Pro — share decks privately, control downloads, hide ads and more …

XFSのbigtimeを少し試してみた

 XFSのbigtimeを少し試してみた

Avatar for Kenichiro MATOHARA

Kenichiro MATOHARA

August 20, 2022
Tweet

More Decks by Kenichiro MATOHARA

Other Decks in Technology

Transcript

  1. 「MIRACLE LINUX Users Meetup 「MIRACLE LINUX Users Meetup #4」に参加 #4」に参加

    先月以下のイベントに参加(Youtubeで動画も公開中) この中のRHEL(Red Hat Enterprise Linux)9の8からの変更点で 「XFSが新機能(bigtime, inobtcount)に対応、作成時もデフォルト に」というものが気になったので少し試してみた. RHEL 9が出たけど、MIRACLE LINUX 9はどうなるの! - connpass MIRACLE LINUX Users Meetup #4 RHEL 9が出たけど、 MIRACLE LINUX 9はどうなるの! - YouTube 3 / 29
  2. XFSの XFSの bigtime bigtime , , inobtcount inobtcount XFSの bigtime

    , inobtcount は5.10からの機能 bigtime いわゆるY2038問題への対策で1901年12月~2486年7月の タイムスタンプに対応できるようになる inobtcount inode btreeサイズを保存するようになり,マウント時間の短縮が される 今回は bigtime を少し試してみた 5 / 29
  3. [GIT PULL] xfs: new code for 5.10, part 1 -

    Darrick J. Wong XFS File-System With Linux 5.10 Punts Year 2038 Problem To The Year 2486 - Phoronix 6 / 29
  4. Debianでの対応状況 Debianでの対応状況 Debian sid で xfsprogs のchangelogを確認.5.10-rc1から bigtime が使えるようになっている,規定値になったのは5.15.0-rc1 から

    xfsprogs-5.10.0-rc1 (04 Dec 2020) - xfsprogs: Add bigtime feature for Y2038 (Darrick Wong) xfsprogs-5.15.0-rc1 (11 Mar 2022) - mkfs: enable inobtcount and bigtime by default (Darrick J. Wong) 7 / 29
  5. 現在の安定版のDebian bullseyeから利用可能で,次期リリースの bookwormから規定値になりそう(多分bookwormのリリースノート に載る) $ rmadison xfsprogs | grep \

    stable -A3 xfsprogs | 5.10.0-4 | stable | source, amd64, arm64, armel, armhf, i386, mips6 xfsprogs | 5.18.0-1 | testing | source, amd64, arm64, armel, armhf, i386, mips6 xfsprogs | 5.19.0-1 | unstable | source, amd64, arm64, armel, armhf, i386, mips6 xfsprogs | 5.19.0-1 | unstable-debug | source 8 / 29
  6. Debian Bullseye(stable) Debian Bullseye(stable) Debian Bullseye でフォーマットしたXFSは bigtime=0 になって いる.

    1 ディスクイメージを作成 2 xfs既定値でフォーマット 3 bigtime=0 になっている $ dd if=/dev/zero of=./disk.img bs=1M count=20 $ sudo mkfs.xfs ./disk.img meta-data=./disk.img isize=512 agcount=1, agsize=5120 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=1 bigtime=0 data = bsize=4096 blocks=5120, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =internal log bsize=4096 blocks=1368, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 1 2 3 10 / 29
  7. 2039年のタイムスタンプでファイルを作成してみると2038年になっ た. 1 2039年のファイルを作る 2 2038年になっている $ sudo mount ./disk.img

    /mnt $ sudo chown `id -u`:`id -u` /mnt $ touch -t '203902022222.22' /mnt/time-2039 $ ls -lA /mnt/ 合計 0 -rw-r--r-- 1 matoken matoken 0 1月 19 2038 time-2039 $ sudo umount /mnt 1 2 11 / 29
  8. Debian bullseye で Debian bullseye で bigtime=1 bigtime=1 xfs_admin -O

    bigtime=1 <DEVICE> コマンドで初期化しなくても bigtime=1 にできるようだが,bullseyeの xfs_admin は未対応だ ったのでbigtimeを有効にしてフォーマットしなおした.2038年を超え たタイムスタンプが作成できる. 1 bigtime=1 を指定してフォーマット 2 bugtime=1 になっている $ sudo mkfs.xfs -f -m bigtime=1 ./disk.img meta-data=./disk.img isize=512 agcount=1, agsize=5120 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=1 bigtime=1 data = bsize=4096 blocks=5120, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =internal log bsize=4096 blocks=1368, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 1 2 12 / 29
  9. 1 2039年のファイルを作る 2 2500年のファイルを作る 3 2039年になっている 4 2486年になっている $ sudo

    chown `id -u`:`id -u` /mnt $ touch -t '203902022222.22' /mnt/time-2039 > touch -t '250002022222.22' /mnt/time-2500 $ ls -lA /mnt 合計 0 -rw-r--r-- 1 matoken matoken 0 2月 2 2039 time-2039 -rw-r--r-- 1 matoken matoken 0 7月 3 2486 time-2500 1 2 3 4 13 / 29
  10.  Debian bullseyeではxfs_adminでbigtimeを設定できない $ sudo xfs_admin -O bigtime=1 ./disk.img Illegal

    option -O Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-U uuid] device [logdev] 14 / 29
  11. Debian sid(unstable)でのbigtime=1 Debian sid(unstable)でのbigtime=1 既定値でmkfsした時点で bigtime=1 になっている.2039年を超え るタイムスタンプも作れる.2486年を超えるものを作ろうとすると 2486年になった. 1

    既定値でフォーマット 2 bigtime=1 になっている > dd if=/dev/zero of=./disk.img bs=1M count=20 > sudo mkfs.xfs ./disk.img meta-data=./disk.img isize=512 agcount=1, agsize=5120 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=1 bigtime=1 inobtcount=1 data = bsize=4096 blocks=5120, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =internal log bsize=4096 blocks=1368, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 1 2 15 / 29
  12. 1 2039年のファイルを作る 2 2500年のファイルを作る 3 2039年になっている 4 2486年になっている > sudo

    mount ./disk.img /mnt > sudo chown `id -u`:`id -u` /mnt > touch -t '203902022222.22' /mnt/time-2039 > touch -t '250002022222.22' /mnt/time-2500 > ls -lA /mnt 合計 0 -rw-r--r-- 1 matoken matoken 0 2月 2 2039 time-2039 -rw-r--r-- 1 matoken matoken 0 7月 3 2486 time-2500 1 2 3 4 16 / 29
  13. Debian sid(unstable) でのbigtime=0 Debian sid(unstable) でのbigtime=0 Debian sidで bigtime=0 で初期化

    2039年のファイルを作ろうと しても2038年になる 1 bigtime=0 で初期化 2 bigtime=0 になっている > sudo mkfs.xfs -f -m bigtime=0 ./disk.img meta-data=./disk.img isize=512 agcount=1, agsize=5120 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=1 bigtime=0 inobtcount=1 data = bsize=4096 blocks=5120, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =internal log bsize=4096 blocks=1368, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 1 2 17 / 29
  14. 1 2039年のファイルを作る 2 2038年になっている > sudo mount ./disk.img /mnt >

    sudo chown `id -u`:`id -u` /mnt > touch -t '203902022222.22' /mnt/time-2039 > ls -lA /mnt 合計 0 -rw-r--r-- 1 matoken matoken 0 1月 19 2038 time-2039 1 2 18 / 29
  15. Debian sidで Debian sidで bigtime bigtime を 0→1 に を

    0→1 に アンマウント状態で xfs_admin コマンドで bigtime を 0→1 にする 1 アンマウントしておく 2 xfs_admin コマンドで bigtime を 1 に設定する $ sudo umount /mnt $ sudo xfs_admin -O bigtime=1 ./disk.img Running xfs_repair to upgrade filesystem. Cannot get host filesystem geometry. Repair may fail if there is a sector size mismatch between the image and the host filesystem. Phase 1 - find and verify superblock... Cannot get host filesystem geometry. Repair may fail if there is a sector size mismatch between the image and the host filesystem. Phase 2 - using internal log - zero log... - scan filesystem freespace and inode maps... - found root inode chunk Adding large timestamp support to filesystem. 1 2 19 / 29
  16. Phase 3 - for each AG... - scan and clear

    agi unlinked lists... - process known inodes and perform inode discovery... - agno = 0 - agno = 1 - process newly discovered inodes... Phase 4 - check for duplicate blocks... - setting up duplicate extent list... - check for inodes claiming duplicate blocks... - agno = 0 - agno = 1 Phase 5 - rebuild AG headers and trees... - reset superblock... Phase 6 - check inode connectivity... - resetting contents of realtime bitmap and summary inodes - traversing filesystem ... - traversal finished ... - moving disconnected inodes to lost+found ... Phase 7 - verify and correct link counts... done 20 / 29
  17. 1 bigtime が 1 になっている $ sudo xfs_info ./disk.img meta-data=./disk.img

    isize=512 agcount=2, agsize=4096 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=1 bigtime=1 inobtcount=1 data = bsize=4096 blocks=8192, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =internal log bsize=4096 blocks=1368, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 1 21 / 29
  18. 1 2039年のファイルを作る 2 2500年のファイルを作る 3 2039年になっている 4 2486年になっている > sudo

    mount ./disk.img /mnt > sudo chown `id -u`:`id -u` /mnt > touch -t '203902022222.22' /mnt/time-2039 > touch -t '250002022222.22' /mnt/time-2500 > ls -lA /mnt 合計 0 -rw-r--r-- 1 matoken matoken 0 2月 2 2039 time-2039 -rw-r--r-- 1 matoken matoken 0 7月 3 2486 time-2500 1 2 3 4 22 / 29
  19.  ディスクが小さいと以下のようなエラーになる.(NG: 20MB〜 24MB,OK 32MB) $ sudo xfs_admin -O bigtime=1

    ./disk.img Running xfs_repair to upgrade filesystem. Cannot get host filesystem geometry. Repair may fail if there is a sector size mismatch between the image and the host filesystem. Phase 1 - find and verify superblock... Only one AG detected - cannot validate filesystem geometry. Use the -o force_geometry option to proceed. 23 / 29
  20. bigtime bigtime のダウングレード(でき のダウングレード(でき ない) ない) bigtime を 1→0 にすることはできない(

    inobtcount も同じ) $ sudo xfs_admin -O bigtime=0 ./disk.img Running xfs_repair to upgrade filesystem. -c bigtime only supports upgrades 24 / 29
  21. 余録1)ext4での時間 余録1)ext4での時間 Debian Bullseye(linux 5.10.0-16, e2fsprogs 1.46.2-2)で は2038年まで,sid(Linux 5.18.0-3, e2fsprogs

    1.46.5-2)で は2446年までのよう.詳細は未確認. $ dd if=/dev/zero of=./disk.img bs=1M count=20 $ sudo mkfs.ext4 ./disk.img $ sudo mount ./disk.img /mnt $ sudo chown `id -u`:`id -u` /mnt $ touch -t '203902022222.22' /mnt/time-2039 $ touch -t '250002022222.22' /mnt/time-2500 $ ls -lA /mnt 合計 12 drwx------ 2 root root 12288 8月 20 03:49 lost+found -rw-r--r-- 1 matoken matoken 0 2月 2 2039 time-2039 -rw-r--r-- 1 matoken matoken 0 5月 11 2446 time-2500 26 / 29
  22. 余録2)btrfsでの時間 余録2)btrfsでの時間 Debian Bullseye(btrfs-progs 5.10.1-2)では2107年7月まで, sid(btrfs-progs 5.19-1)では9999年12月までのよう(超えるとエ ラーとなる).詳細は未確認. $ touch

    -t '999912312359.59' ./time-9999 $ touch -t '1000001010000.00' ./time-10000 touch: `1000001010000.00': 無効な日付の書式です $ ls -l ./time-* -rw-r--r-- 1 matoken matoken 0 2月 2 2039 ./time-2039 -rw-r--r-- 1 matoken matoken 0 2月 2 2500 ./time-2500 -rw-r--r-- 1 matoken matoken 0 2月 2 2900 ./time-2900 -rw-r--r-- 1 matoken matoken 0 2月 2 5000 ./time-5000 -rw-r--r-- 1 matoken matoken 0 2月 2 9000 ./time-9000 -rw-r--r-- 1 matoken matoken 0 2月 2 9999 ./time-9999 27 / 29
  23. と思ったけどエラーが出るの変 と思ったけどエラーが出るの変 だなと別のコマンドを試すとも だなと別のコマンドを試すとも っと行けた っと行けた 恐らく,touchコマンドが9999年まで,faketimeコマンドが 999999999年まで,Btefsは? $ faketime

    "9999999990101" touch 999999999 $ faketime "99999999990101" touch 9999999999 date: `99999999990101' は無効な日付です Error: Timestamp to fake not recognized, please re-try with a different timestamp. $ ls -l 99999* -rw-r--r-- 1 matoken matoken 0 1月 1 99999 99999 -rw-r--r-- 1 matoken matoken 0 1月 1 999999 999999 -rw-r--r-- 1 matoken matoken 0 1月 1 9999999 9999999 -rw-r--r-- 1 matoken matoken 0 1月 1 99999999 99999999 -rw-r--r-- 1 matoken matoken 0 1月 1 999999999 999999999 28 / 29