tune2fs
可以设置最大挂载计数(在-c
e2fsck 启动之前)以及实际(当前)挂载计数-C
。我正在寻找一种读取这两个值的方法。
问问题
2659 次
1 回答
2
手册页有-l
:
sehe@desktop:~$ sudo tune2fs -l /dev/mapper/debian-uburoot | grep count
Inode count: 1310720
Block count: 5241856
Reserved block count: 262092
Mount count: 12
Maximum mount count: -1
所以你可以做到
function mount_count()
{
tune2fs -l "$1" |
grep '^Mount count:' |
grep -oP '\d+'
}
现在你可以
mounted=$(mount_count /dev/sda1)
echo "Volume sda1 has already been mounted $mounted times since last check"
于 2013-12-31T12:19:32.337 回答