|
新买的一个 320G的移动硬盘,在商家那里已经被分为4个区,并都格式化为 NTFS格式。现在就拿这块盘来练手练手,主要掌握 fdisk 的用法。
首先用 df 命令查看一下整个磁盘概况,显示结果如下(部分):/dev/sdd4 97522580 68968 97453612 1% /media/新加卷
/dev/sdd3 71682028 68176 71613852 1% /media/新加卷_
/dev/sdd1 71681996 68176 71613820 1% /media/新加卷__
/dev/sdd2 71682028 68176 71613852 1% /media/新加卷___
在用 fdisk -l 看一下磁盘情况:Disk /dev/sdd: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x581f9f48
Device Boot Start End Blocks Id System
/dev/sdd1 1 8924 71681998+ 7 HPFS/NTFS
/dev/sdd2 8925 17848 71682030 7 HPFS/NTFS
/dev/sdd3 17849 26772 71682030 7 HPFS/NTFS
/dev/sdd4 26773 38913 97522582+ 7 HPFS/NTFS 由上面的信息看到,磁盘的容量大小为 320G,总共为 320072933376字节。
共有 38913个磁柱(cylinders ),每个磁柱通过 255 个磁头管理读写;每个磁头管理 63 个磁区(扇区),每个磁区(扇区)大小为 512 个字节,所以每个磁柱的字节数为:255 * 63 * 512 = 16065 * 512 = 8225280 bytes Device 设备名;
Boot 是否为开机启动区块?(如标有 * 号的则是)
start 磁柱起始编号
end 磁柱结束编号
blocks 分区的大小(K 为单位),以 1K 为单位的容量。
ID,system 分区的文件系统(仅作为一个提示,不见得就是分区的真正文件系统)
先看一下 fdisk 都有哪些操作,按下 m 后看到使用帮助,常用的加亮显示:Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition #删除一个分区
l list known partition types
m print this menu
n add a new partition #新增一个分区
o create a new empty DOS partition table
p print the partition table #显示分区表
q quit without saving changes #不存储改变就退出
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit #将之前的改动写入分区表
x extra functionality (experts only)
1、进行删除分区实验:Command (m for help): d #需要进行删除操作
Partition number (1-4): 4 #选择删除第 4 个分区
[quote]
删除后,按下 p 键,看到如下结果:
[quote]
Device Boot Start End Blocks Id System
/dev/sdd1 1 8924 71681998+ 7 HPFS/NTFS
/dev/sdd2 8925 17848 71682030 7 HPFS/NTFS
/dev/sdd3 17849 26772 71682030 7 HPFS/NTFS 果然是删除了,或者重启或者使用 partprobe 命令进行设置生效。
2、进行新增加分区的实验:
在上面的操作中,删除了一个分区,现在增加一个分区,就用刚才删除的那个分区的空间增加:n
[quote]
出现提示:
[quote]
Command action
e extended #增加一个扩展分区
p primary partition (1-4) #增加一个主分区
把上面删除的分区全部变为扩展分区:Command (m for help): n #增加一个分区
Command action
e extended
p primary partition (1-4)
e
Selected partition 4
First cylinder (26773-38913, default 26773): 26773 #起始柱面
Last cylinder, +cylinders or +size{K,M,G} (26773-38913, default 38913): 38913 #结束柱面
按 p 键看一下分区情况:Disk /dev/sdd: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x581f9f48
Device Boot Start End Blocks Id System
/dev/sdd1 1 8924 71681998+ 7 HPFS/NTFS
/dev/sdd2 8925 17848 71682030 7 HPFS/NTFS
/dev/sdd3 17849 26772 71682030 7 HPFS/NTFS
/dev/sdd4 26773 38913 97522582+ 5 Extended
在把扩展分区分出一个20G的 ext3 空间:Command (m for help): n
First cylinder (26773-38913, default 26773): 26773
Last cylinder, +cylinders or +size{K,M,G} (26773-38913, default 38913): +20G
查看一下分区情况(p): Device Boot Start End Blocks Id System
/dev/sdd1 1 8924 71681998+ 7 HPFS/NTFS
/dev/sdd2 8925 17848 71682030 7 HPFS/NTFS
/dev/sdd3 17849 26772 71682030 7 HPFS/NTFS
/dev/sdd4 26773 38913 97522582+ 5 Extended
/dev/sdd5 26773 29384 20980858+ 83 Linux
最后输入 w 写入,接着执行 partprobe 或者 重启电脑完成分区。
格式化:
格式化过程及结果:mke2fs 1.41.1 (01-Sep-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1313760 inodes, 5245214 blocks
262260 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
161 block groups
32768 blocks per group, 32768 fragments per group
8160 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override. |
|