
xfs_quota -c "free" /mnt/xfs
出力を決定的に解析できますか?問題は、出力に搭載されたブロックデバイスのパス長によって/mnt/xfs
フォーマットが異なることです。
ブロックデバイスパスが十分に短いブロックデバイスの場合、xfs_quota
これは1行に出力されます。
└$ xfs_quota -c "free" /mnt/xfs
Filesystem 1K-blocks Used Available Use% Pathname
/dev/loop20 983040 289076 693964 29% /mnt/xfs
ただし、ブロックデバイスのパスが長い場合(たとえば、LVMボリュームの一部である場合)、出力は複数行に分割されます。
$ xfs_quota -c "free" /scratch/local
Filesystem 1K-blocks Used Available Use% Pathname
/dev/mapper/vg_scratch-lv_scratch
1230848 32996 1197852 3% /scratch/local
Xfs_quota
-N
おそらく、マシンの読みやすさを簡単にするためにヘッダーを隠すフラグがありますが、それを使用してもこの変数の動作は削除されません。
$ xfs_quota -c "free -N" /scratch/local
/dev/mapper/vg_scratch-lv_scratch
1230848 32996 1197852 3% /scratch/local