码迷,mamicode.com
首页 > 系统相关 > 详细

3步实现制作并挂载自己的Linux硬盘分区

时间:2015-01-22 23:25:49      阅读:470      评论:0      收藏:0      [点我收藏+]

标签:linux   挂载   

1. 建立一个大型档案

# 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


2.格式化

# 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.


3.挂载

# 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

成功!

3步实现制作并挂载自己的Linux硬盘分区

标签:linux   挂载   

原文地址:http://blog.csdn.net/aqzwss/article/details/43026033

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!