创建稀疏文件

时间:2014-08-10 10:27:07

标签: linux file

我尝试了lseekdd if=/dev/urandom seek=7 bs=4096 count=2 of=fwh,但他们并没有在我的电脑上工作。 ls -lks结果为: 44 -rw-rw-r-- 1 guangmu guangmu 36864 Aug 10 18:19 fwh

我尝试rm文件reboot,甚至通过debugfs清理fwt使用的块。这些没有帮助。

我的文件系统是ext4,操作系统是ubuntu 14.04。以下是sudo tune2fs -l /dev/sda5

的结果
tune2fs 1.42.9 (4-Feb-2014)
Filesystem volume name:   
Last mounted on:          /
Filesystem UUID:          e051336c-6a7a-4683-9c24-1230676170b1
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              34594816
Block count:              138359808
Reserved block count:     6917990
Free blocks:              109566416
Free inodes:              33280312
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      991
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Flex block group size:    16
Filesystem created:       Mon Jan 20 20:56:20 2014
Last mount time:          Mon Aug 11 11:08:31 2014
Last write time:          Mon Aug 11 11:08:30 2014
Mount count:              387
Maximum mount count:      -1
Last checked:             Mon Jan 20 20:56:20 2014
Check interval:           0 ()
Lifetime writes:          743 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:              256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
First orphan inode:       18877404
Default directory hash:   half_md4
Directory Hash Seed:      780cc1b8-1fa1-4751-9385-270b563b29cd
Journal backup:           inode blocks

我做错了吗?

2 个答案:

答案 0 :(得分:0)

不,这是正确的。您在seekfwh编辑(或寻找可能?)7个4096字节的块,然后写入2个4096字节的块。所以你希望fwh包含9个4096字节的块,即36,864字节 - 完全和你一样。

或者我错过了什么?你有什么期待?

答案 1 :(得分:0)

这是我的粗心大意。:(

/home作为ecrpyptfs挂载,不支持稀疏文件。