# dd if=/dev/zero of=/home/loopdev
bs=1M count=512
if : input file /dev/zero是会一直输出0的装置
of : output file
bs是每个block大小
count是总共有多少个bs
屏幕输出:
512+0 records in
//读入512笔资料
512+0 records out //输出512笔数据
536870912 bytes (537 MB) copied, 6.45734 s, 83.1 MB/s
# mkfs -t ext4 /home/loopdev
使用ext4文件系统格式
屏幕输出:
mke2fs 1.41.12 (17-May-2010)
/home/loopdev is not a block special device.
Proceed anyway? (y,n) y //由于不是正常的装置,所以会提示,选择y,按Enter继续
屏幕输出:
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
32768 inodes, 131072 blocks
6553 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=134217728
4 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
# mount -o loop /home/loopdev /root/myloopdev/
将该档案挂载到/root/myloopdev/下
# df
屏幕输出:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda1 20641404 6202512 13390368 32% /
tmpfs 960472 0 960472 0% /dev/shm
/home/loopdev 516040 16780 473048 4% /root/myloopdev
成功!
原文地址:http://blog.csdn.net/aqzwss/article/details/43026033