linux_arm
mkfs格式化命令的疑惑
我在网上经常可以看到这样的操作
dd if=/dev/zero of=<filename> count=<blocks>
mkfs.ext2 <filename>
mount -t ext2 -o loop <filename> /mnt
这样就可以访问<filename>文件中的内容了,mkfs.ext2不是用来格式化一个磁盘的吗?比如
mkfs.ext2 /dev/sda2
但是它怎么可以格式化一个文件呢?这个文件所在的磁盘格式会被改变吗?
linux_arm
[quote]原帖由 [i]jerrywjl[/i] 于 2008-6-10 12:17 发表 [url=http://linux.chinaunix.net/bbs/redirect.php?goto=findpost&pid=6609517&ptid=1010070][img]http://linux.chinaunix.net/bbs/images/common/back.gif[/img][/url]
第一条命令是建立了一个固定大小的块设备,而第二条命令是给这个块设备建立文件系统。
文件系统建立成功之后就可以挂载。 [/quote]
您这里所说的块设备应该是一个文件块吧?
我的理解是第一个命令建立一个文件,这个文件是一个全0的数据块(不知道和touch建立的文件有何区别?)
第二个命令把这个文件的数据组织结构变换为Ext2形式的
第三条命令是用loop设备把这个文件块当作一个块设备来挂载
不知道理解是否正确?
可可火山
大家讨论的东西是 linux 内的一种file system.
loopback filesystem,这是个virtual file system.
check following link for more information:
[url]http://freshmeat.net/articles/view/1387/[/url]
光盘挂载也加 -o loop,所以光盘的文件系统类似?
Magicloud
[quote]原帖由 [i]可可火山[/i] 于 2008-6-10 13:00 发表 [url=http://linux.chinaunix.net/bbs/redirect.php?goto=findpost&pid=6609569&ptid=1010070][img]http://linux.chinaunix.net/bbs/images/common/back.gif[/img][/url]
大家讨论的东西是 linux 内的一种file system.
loopback filesystem,这是个virtual file system.
check following link for more information:
[url]http://freshmeat.net/articles/view/1387/[/url]
光盘挂载也加 ... [/quote]
正解,楼上楼下都是典型的回帖不看贴。
[[i] 本帖最后由 Magicloud 于 2008-6-11 11:16 编辑 [/i]]
lFANS
-l filename
Read the bad blocks list from filename. Note that the block numbers in the bad block list must be gen-
erated using the same block size as used by mke2fs. As a result, the -c option to mke2fs is a much sim-
pler and less error-prone method of checking a disk for bad blocks before formatting it, as mke2fs will
automatically pass the correct parameters to the badblocks program.