linux 下硬盘分区

来源:百度文库 编辑:神马文学网 时间:2024/04/29 13:00:13
Linux 下硬盘分区实践
1、linux下硬盘管理简介
和Windows为每一个分区设定一个驱动和盘符不同,Linux把所有的硬盘当作一个整体来看--全部挂载于/文件系统下面。但是Linux还是沿用MS/DOC的硬盘物理分区模式:主分区(扩展分区)+逻辑分区(logical)模式。这里区分一下主分区(primary)和扩展分区(extended),简单的说,一块硬盘最多有4个主分区,如果需要继续增加硬盘的分区,那么就要把主分区设置成扩展分区,在扩展分区上面进行逻辑分区的划分,而逻辑分区的数量是没有限制的。实际上应该说:主分区数目+扩展分区数目<=4。
2、linux下分区工具fdisk
用法:fdisk device。
进去之后,输入m查看帮助信息,可以看到:
Command (m for help): 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)
输入n增加分区,输入d删除分区。
完成之后输入w保存。
注意:如果出现WARNING: Re-reading the partition table failed with error 16: Device or resourcebusy.The kernel still uses the old table.The new table will be used at the next reboot.
则表示内核没有立刻更新硬盘表项需要重启的时候更新,但这是由于新分的硬盘没有格式化可能会导致文件系统监测不能通过。
解决的办法是用portprobe命令来更新内核的硬盘表项。这样就不需要重启了。