#author("2019-10-05T18:38:59+00:00","default:sysosa","sysosa") #author("2019-10-06T10:15:49+00:00","default:sysosa","sysosa") &color(red){とちゅう}; CentOS8 参照先[[https://strugglers.net/~andy/blog/2017/01/10/xfs-reflinks-and-deduplication/>+https://strugglers.net/~andy/blog/2017/01/10/xfs-reflinks-and-deduplication/]] [[https://hooks.technology/2018/03/xfs-deduplication-with-reflinks/>+https://hooks.technology/2018/03/xfs-deduplication-with-reflinks/]] #code(nonumber){{ [root@localhost ~]# mkfs.xfs -L dedup -m reflink=1 /dev/nvme0n2p1 meta-data=/dev/nvme0n2p1 isize=512 agcount=4, agsize=1310655 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=1 data = bsize=4096 blocks=5242619, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =internal log bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 [root@localhost ~]# [root@localhost ~]# echo "LABEL=dedup /data xfs defaults 0 0" >> /etc/fstab [root@localhost ~]# mkdir /data [root@localhost ~]# mount -a [root@localhost ~]# df -lTh ファイルシス タイプ サイズ 使用 残り 使用% マウント位置 devtmpfs devtmpfs 888M 0 888M 0% /dev tmpfs tmpfs 904M 0 904M 0% /dev/shm tmpfs tmpfs 904M 18M 886M 2% /run tmpfs tmpfs 904M 0 904M 0% /sys/fs/cgroup /dev/mapper/cl-root xfs 19G 5.8G 13G 32% / /dev/nvme0n1p1 ext4 488M 133M 320M 30% /boot tmpfs tmpfs 181M 16K 181M 1% /run/user/42 tmpfs tmpfs 181M 4.0K 181M 1% /run/user/0 /dev/nvme0n2p1 xfs 20G 176M 20G 1% /data [root@localhost ~]# }} ***duperemove [#k72c30f3] [[https://github.com/markfasheh/duperemove>+https://github.com/markfasheh/duperemove]] 開発環境をインストールして(yum groupinstall "Development Tools")、 追加に「glib2-devel」「sqlite-devel」「libatomic」パッケージもインストール #code(nonumber){{ [root@localhost ~]# git clone https://github.com/markfasheh/duperemove Cloning into 'duperemove'... remote: Enumerating objects: 2735, done. remote: Total 2735 (delta 0), reused 0 (delta 0), pack-reused 2735 Receiving objects: 100% (2735/2735), 994.38 KiB | 545.00 KiB/s, done. Resolving deltas: 100% (1873/1873), done. [root@localhost ~]# cd duperemove [root@localhost duperemove]# make ; make install [root@localhost duperemove]# ls -l /usr/local/sbin/ 合計 1248 -rwxr-xr-x. 1 root root 23240 10月 5 13:45 btrfs-extent-same -rwxr-xr-x. 1 root root 665488 10月 5 13:45 duperemove -rwxr-xr-x. 1 root root 435968 10月 5 13:45 hashstats -rwxr-xr-x. 1 root root 143664 10月 5 13:45 show-shared-extents [root@localhost duperemove]# }} ***Test [#y1bef18b] TIFFファイルを重複排除させてみた #code(nonumber){{ [root@localhost /]# df /data/ ファイルシス 1K-ブロック 使用 使用可 使用% マウント位置 /dev/nvme0n2p1 20960236 9476032 11484204 46% /data [root@localhost /]# }} 実際に重複排除してくれるコマンド duperemove のオプションは下記の通り #code(nonumber){{ [root@localhost ~]# duperemove duperemove v0.12.dev Find duplicate extents and optionally dedupe them. Basic usage: duperemove [-r] [-d] [-h] [-v] [-A] [--hashfile=hashfile] OBJECTS "OBJECTS" is a list of files (or directories) which we want to find duplicate extents in. If a directory is specified, all regular files inside of it will be scanned. <switches> -r Enable recursive dir traversal. -d De-dupe the results (must run on a supported fs). --hashfile=FILE Store hashes in this file. -A Open files for dedupe in read-only mode. -h Print numbers in human-readable format. -v Print extra information (verbose). --help Prints this help text. Please see the duperemove(8) manpage for a complete list of options. [root@localhost ~]# }}