如何將多個選項傳遞給tune2fs -E mount_opts
?
根據手冊:
mount_opts=mount_option_string Set a set of default mount options which will be used when the file system is mounted. Unlike the bitmask-based default mount options which can be specified with the -o option, mount_option_string is an arbitrary string with a maximum length of 63 bytes, which is stored in the superblock.
如果我嘗試設置一個選項,它會起作用:
$ tune2fs -E mount_opts=data=writeback /dev/sde2 tune2fs 1.43.5 (04-Aug-2017) Setting extended default mount options to 'data=writeback'
但是如果我嘗試設置多個選項,它似乎與
tune2fs
自己的解析機制衝突:$ tune2fs -E mount_opts=data=writeback,noatime /dev/sde2 tune2fs 1.43.5 (04-Aug-2017) Bad options specified. Extended options are separated by commas, and may take an argument which is set off by an equals ('=') sign. Valid extended options are: clear_mmp hash_alg=<hash algorithm> mount_opts=<extended default mount options> stride=<RAID per-disk chunk size in blocks> stripe_width=<RAID stride*data disks in blocks> test_fs ^test_fs
如何在“mount_opts”上傳遞具有多個選項的字元串?
正如托馬斯所說,
sparated by commas
是為了擴展選項分離。但是,mount_opts
選項分離也是使用,
(參見 Linux 核心fs/ext4/super.c:parse_options()
)完成的,並且在這個答案中e2fsprogs
’mke2fs
並且tune2fs
無法在語義上將一個與另一個區分開來。與 Theodore Y. Ts’o的郵件交流顯示:
是的,這是 tune2fs 的一個缺點。
ext
使用通用操作工具沒有語法來實現這一點。Ts’o 建議使用debugfs
以下解決方法:您可以使用 debugfs 設置擴展掛載選項:
debugfs -w -R "set_super_value mount_opts foo,bar" /dev/sda1
在這種情況下,您需要
debugfs -w -R "set_super_value mount_opts data=writeback,noatime" /dev/sde2
,但這並沒有您期望的效果。掛載後,
ext4
核心模組會抱怨Unrecognized mount option "noatime" or missing value
; 事實上,只能指定ext
-specific 選項,而noatime
不是(參見相同的核心源文件,可用選項列在tokens
數組中)。功能上最接近的匹配是**lazytime
**.所以,使用
debugfs -w -R "set_super_value mount_opts data=writeback,lazytime" /dev/sde2
.