Linux精讲——fdisk磁盘分区

磁盘分区原则:

  • 每个磁盘可分的“主分区 + 扩展分区”不能大于 4
  • 主分区可以分 0~4 个
  • 扩展分区最多只能分1个,在扩展分区里面再分成逻辑分区,逻辑分区没有数量限制
  • 逻辑分区的分区号从 5 开始,比如:sdb5、sdb6
  • 若分区号在 1~4,那么一定是主分区或扩展分区

fdisk 分区方法:

fdisk -l            # 列出所有磁盘的分区表信息
fdisk -l /dev/sdxx  # 列出指定磁盘的分区表信息

[root@centos01 ~]# fdisk /dev/sdb  ## 对指定磁盘进行分区操作

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

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)

Command (m for help): n   ## 创建新分区
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
p    ## 选择分主分区
Partition number (1-4): 3    ## 分区号选择3
First cylinder (917-1305, default 917):    ## enter 使用默认开始位置
Using default value 917
Last cylinder, +cylinders or +size{K,M,G} (917-1305, default 1305): +1G   ## 增加1G

Command (m for help): d   ## 删除一个分区
Partition number (1-5): 3   ## 选择要删除的分区号

Command (m for help): w   ## 保存并退出
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值