[root@client~]#ddif=/dev/zeroof=filebs=1Mcount=10
[root@client~]#cpfile/mnt/mfs
文件信息查看
mfsfileinfo
[root@client~]#mfsfileinfo/mnt/mfs/file
/mnt/mfs/file:
chunk0:0000000000000001_00000001/(id:1ver:1)
copy1:192.168.108.161:9422
copy2:192.168.108.162:9422
copy3:192.168.108.163:9422
文件检查
mfscheckfile
[root@client~]#mfscheckfile/mnt/mfs/file
/mnt/mfs/file:
3copies:1chunks
目录信息查看
mfsdirinfo
[root@client~]#rm/mnt/mfs/file
[root@client~]#mkdir/mnt/mfs/newdir
[root@client~]#cpfile/mnt/mfs/newdir
[root@client~]#mfsdirinfo/mnt/mfs/newdir
/mnt/mfs/newdir/:
inodes:2(2)//inode个数,1个目录,1个文件
directories:1(1)//1个目录
files:1(1)//1个文件
goodfiles:1(1)//正常文件个数
undergoalfiles:0(0)
missingfiles:0(0)
chunks:1(1)
goodchunks:1(1)
undergoalchunks:0(0)
missingchunks:0(0)
length:10M(10485760)
size:10M(10490880)//这里是文件大小
hddusage:30M(31472640)//由于我设置文件份数为3,因此这里为3*100M
[root@client~]#cp/data/filenewdir/file_2
/mnt/mfs/newdir/:
inodes:3(3)
directories:1(1)
files:2(2)
goodfiles:2(2)
undergoalfiles:0(0)
missingfiles:0(0)
chunks:2(2)
goodchunks:2(2)
undergoalchunks:0(0)
missingchunks:0(0)
length:20M(20971520)
size:20M(20981760)
hddusage:60M(62945280)
创建文件快照
mfssnapshot
[root@client/mnt/mfs/newdir]#mfssnapshotmysnapshotfile
[root@client/mnt/mfs/newdir]#ll
total30720
-rw-r–r–1rootroot10485760Oct1616:43file
-rw-r–r–1rootroot10485760Oct1616:44file_2
-rw-r–r–1rootroot10485760Oct1616:58mysnapshot
[root@monitor/mnt/mfs/newdir]#mfsfileinfomysnapshot
mysnapshot:
chunk0:0000000000000003_00000001/(id:3ver:1)
copy1:192.168.108.161:9422
copy2:192.168.108.162:9422
copy3:192.168.108.163:9422
[root@monitor/mnt/mfs/newdir]#mfsfileinfofile
file:
chunk0:0000000000000003_00000001/(id:3ver:1)
copy1:192.168.108.161:9422
copy2:192.168.108.162:9422
copy3:192.168.108.163:9422
通过mfsfileinfo命令可以查看创建出来的文件快照,它只占用了一个inode,并不占用磁盘空间,就像ln命令创建硬链接类似。但mfsdirinfo的显示似乎有些问题:
[root@monitor/mnt/mfs/newdir]#mfsdirinfo/mnt/mfs/newdir/
/mnt/mfs/newdir/:
inodes:4(4)
directories:1(1)
files:3(3)
goodfiles:3(3)
undergoalfiles:0(0)
missingfiles:0(0)
chunks:3(3)
goodchunks:3(3)
undergoalchunks:0(0)
missingchunks:0(0)
length:30M(31457280)
size:30M(31472640)
hddusage:90M(94417920)
利用mfsdirinfo查看目录信息发现刚刚创建的快照文件也占用了与原文件相同大小的磁盘空间。但实际情况真的如此吗?
查看master的系统日志
Oct1617:14:00experimentmfsmaster[24445]:inodes:5
Oct1617:14:00experimentmfsmaster[24445]:dirnodes:2
Oct1617:14:00experimentmfsmaster[24445]:filenodes:3
Oct1617:14:00experimentmfsmaster[24445]:chunks:2
Oct1617:14:00experimentmfsmaster[24445]:chunkstodelete:0