1.使用fdisk创建6个分区[1P+1E(5L)]   //dev/sdb1 /dev/sdb5 /dev/sdb6 /dev/sdb7 /dev/sdb8 /deb/sdb9

 [root@server ~]# fdisk -l

 Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000aec72 Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 26 91 524288 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 91 1045 7658496 83 Linux Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

2.fdisk -cu /dev/sdb开始分区

 [root@server ~]# fdisk -cu /dev/sdb   //-c:表示丢弃DOS兼容模式,切换到mode模式; -u:表示从柱面分区改为扇区分区
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x94c5ab35.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) Command (m for help):

3.输入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) Command (m for help):

4.分出一个10M的主分区

 Command (m for help): n
Command action
e extended //代表扩展分区
p primary partition (1-4) //代表主分区
p //选择p 主分区
Partition number (1-4): 1
First sector (2048-2097151, default 2048): //默认2048开始
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): +10M Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x94c5ab35 Device Boot Start End Blocks Id System
/dev/sdb1 2048 22527 10240 83 Linux

5.将剩余的空间全部分配给扩展分区

 Command (m for help): n
Command action
e extended
p primary partition (1-4)
e
Partition number (1-4): 2 //分区编号选择为2
First sector (22528-2097151, default 22528): //默认缺省大小
Using default value 22528
Last sector, +sectors or +size{K,M,G} (22528-2097151, default 2097151): //默认缺省大小
Using default value 2097151 Command (m for help): p //打印 Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x94c5ab35 Device Boot Start End Blocks Id System
/dev/sdb1 2048 22527 10240 83 Linux
/dev/sdb2 22528 2097151 1037312 5 Extended Command (m for help): n

6.接着将扩展分区分成5个逻辑分区,首先创建第1个大小为10M的逻辑分区

 Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l //选择创建逻辑分区
First sector (24576-2097151, default 24576): //默认开始直接回车
Using default value 24576
Last sector, +sectors or +size{K,M,G} (24576-2097151, default 2097151): +10M //输入分区大小10M Command (m for help): p //打印分区 Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x94c5ab35 Device Boot Start End Blocks Id System
/dev/sdb1 2048 22527 10240 83 Linux
/dev/sdb2 22528 2097151 1037312 5 Extended
/dev/sdb5 24576 45055 10240 83 Linux //分区表从5开始,代表逻辑分区

7.接着创建扩展分区中第2个大小为10M的逻辑分区

 Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First sector (47104-2097151, default 47104):
Using default value 47104
Last sector, +sectors or +size{K,M,G} (47104-2097151, default 2097151): +10M Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x94c5ab35 Device Boot Start End Blocks Id System
/dev/sdb1 2048 22527 10240 83 Linux
/dev/sdb2 22528 2097151 1037312 5 Extended
/dev/sdb5 24576 45055 10240 83 Linux
/dev/sdb6 47104 67583 10240 83 Linux

8.接着创建扩展分区中第3个大小为10M的逻辑分区

 Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First sector (69632-2097151, default 69632):
Using default value 69632
Supported: 10^N: KB (KiloByte), MB (MegaByte), GB (GigaByte)
2^N: K (KibiByte), M (MebiByte), G (GibiByte)
Last sector, +sectors or +size{K,M,G} (69632-2097151, default 2097151): =
Last sector, +sectors or +size{K,M,G} (69632-2097151, default 2097151): +10M Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x94c5ab35 Device Boot Start End Blocks Id System
/dev/sdb1 2048 22527 10240 83 Linux
/dev/sdb2 22528 2097151 1037312 5 Extended
/dev/sdb5 24576 45055 10240 83 Linux
/dev/sdb6 47104 67583 10240 83 Linux
/dev/sdb7 69632 90111 10240 83 Linux

9.接着创建扩展分区中第4个大小为10M的逻辑分区

 Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First sector (92160-2097151, default 92160):
Using default value 92160
Last sector, +sectors or +size{K,M,G} (92160-2097151, default 2097151): +10M Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x94c5ab35 Device Boot Start End Blocks Id System
/dev/sdb1 2048 22527 10240 83 Linux
/dev/sdb2 22528 2097151 1037312 5 Extended
/dev/sdb5 24576 45055 10240 83 Linux
/dev/sdb6 47104 67583 10240 83 Linux
/dev/sdb7 69632 90111 10240 83 Linux
/dev/sdb8 92160 112639 10240 83 Linux

10.接着创建扩展分区中第5个逻辑分区,将剩余空间都分配

 Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First sector (114688-2097151, default 114688):
Using default value 114688
Last sector, +sectors or +size{K,M,G} (114688-2097151, default 2097151):
Using default value 2097151 Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x94c5ab35 Device Boot Start End Blocks Id System
/dev/sdb1 2048 22527 10240 83 Linux
/dev/sdb2 22528 2097151 1037312 5 Extended
/dev/sdb5 24576 45055 10240 83 Linux
/dev/sdb6 47104 67583 10240 83 Linux
/dev/sdb7 69632 90111 10240 83 Linux
/dev/sdb8 92160 112639 10240 83 Linux
/dev/sdb9 114688 2097151 991232 83 Linux

11.将/dev/sdb9改为LVM分区(即动态调整)

 Command (m for help): t
Partition number (1-9): 9 //要修改的分区标识
Hex code (type L to list codes): 8e //代表LVM,可用l查询对应的Id
Changed system type of partition 9 to 8e (Linux LVM) Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x94c5ab35 Device Boot Start End Blocks Id System
/dev/sdb1 2048 22527 10240 83 Linux
/dev/sdb2 22528 2097151 1037312 5 Extended
/dev/sdb5 24576 45055 10240 83 Linux
/dev/sdb6 47104 67583 10240 83 Linux
/dev/sdb7 69632 90111 10240 83 Linux
/dev/sdb8 92160 112639 10240 83 Linux
/dev/sdb9 114688 2097151 991232 8e Linux LVM

12.分区结尾工作

 Command (m for help): w    //写入分区表
The partition table has been altered! Calling ioctl() to re-read partition table.
Syncing disks.
[root@server ~]# partprobe /dev/sdb //将分区表的修改结果告诉内核,这样可用忽略重启系统

至此分区工作结束!!

使用fdisk给新增加硬盘分区的更多相关文章

  1. LVM XFS增加硬盘分区容量(resize2fs: Bad magic number in super-block while)

    LVM XFS增加硬盘分区容量(resize2fs: Bad magic number -- :: 分类: Linux LVM XFS增加硬盘分区容量(resize2fs: Bad magic num ...

  2. mysql数据文件迁移到新的硬盘分区的方法

    该系统增加了一个硬盘.要创建新的分区/data文件夹,mysql对于数据文件夹/var/lib/mysql 1.  停止mysql维修 [root@localhost~]# service mysql ...

  3. CentOS 6.5新增加硬盘挂载并实现开机自动挂载

    Centos7.x请参考:https://www.cnblogs.com/himismad/p/7851548.html 在内网主机Centos 6.5新增一个50G硬盘 (搭建在CAS服务器,直接新 ...

  4. centos6.5新增加硬盘挂载并实现开机时自动挂载

    在内网主机新增一个2T硬盘,先关机断电再连接硬盘数据线和电源线! 查看当前磁盘设备信息: [root@tb ~]# fdisk -lWARNING: GPT (GUID Partition Table ...

  5. centos6.5新增加硬盘挂载并实现开机自动挂载

    在内网主机新增一个2T硬盘,先关机断电再连接硬盘数据线和电源线! 查看当前磁盘设备信息: [root@tb ~]# fdisk -l WARNING: GPT (GUID Partition Tabl ...

  6. LVM XFS增加硬盘分区容量最后一步的时候动态扩容报错

    在我们lvextend扩容完之后,想动态扩容时出现错误.我们可以用以下命令来进行操作. 若不是xfs我们可以用resize2fs,这里报错了 [root@Mysql01-213-66 ~]# resi ...

  7. 多硬盘分区管理fdisk

    原文:http://blog.fens.me/linux-fdisk/ ---------------------------------------------------------------- ...

  8. Liunx 硬盘分区

    1)什么要进行硬盘分区:a) 更容易管理和控制系统,因为相关的文件和目录都放在一个分区中.b) 系统效率更高.c) 可以限制用户使用硬盘的份额(磁盘空间的大小).d) 更容易备份和恢复. 2)硬盘的逻 ...

  9. 烂泥:KVM虚拟机windows系统增加硬盘

    本文由秀依林枫提供友情赞助,首发于烂泥行天下. 前一篇文章介绍了有关linux系统添加硬盘的方法,这次我们来介绍有关windows系统添加的相关步骤. 其实linux和windows添加的硬盘的方法都 ...

随机推荐

  1. 最近做了了解java基础的一些题,整理自己用到的一些函数和了解的一些名词

    [程序1]题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子对数为多少? 程序分析: 兔子的规律为数列1,1,2, ...

  2. Android之SQLite数据库篇

    一.SQLite简介 Google为Andriod的较大的数据处理提供了SQLite,他在数据存储.管理.维护等各方面都相当出色,功能也非常的强大. 二.SQLite的特点 1.轻量级使用 SQLit ...

  3. 【Win 10应用开发】延迟加载图片的另一种方法

    上一篇文章中老周给大伙介绍了x:Phase和x:Bind的用法,并演示了一个延迟加载的示例.不过,那个例子会遗留一个问题,就是UI线程被阻塞,所以启动应用较慢. 如果希望图片可以延迟加载,或许我们可以 ...

  4. 3. SVM分类器求解(1)——Lagrange duality

    先抛开上面的二次规划问题,先来看看存在等式约束的极值问题求法,比如下面的最优化问题: 目标函数是f(w),下面是等式约束.通常解法是引入拉格朗日算子,这里使用来表示算子,得到拉格朗日公式为 是等式约束 ...

  5. OpenCASCADE Job - Shoe Doctor

    鞋博士 鞋博士经过8年沉淀,在鞋类工业4.0全流程平台上积累了相当的技术实力,获投资商亲睐. 新的一年,在投资商协助下,将踏上新的征途,因此诚邀您加盟顶层技术合伙人. 如果您具备以下实力,我们期待您的 ...

  6. 实现MVC自定义过滤器,自定义Area过滤器,自定义Controller,Action甚至是ViewData过滤器

    MVC开发中几种以AOP方式实现的Filters是非常好用的,默认情况下,我们通过App_Start中的FilterConfig来实现的过滤器注册是全局的,也就是整个应用程序都会使用的,针对单独的Fi ...

  7. 表单reset无法重置hidden的解决方案

    方法一:用text代替hidden,设置text隐藏 <input id="id" name="id" style="display: none ...

  8. .net请求URL过长,解决方案

    <system.web> 节点下加上 <httpRuntime requestValidationMode="2.0" maxQueryStringLength= ...

  9. APNS 远程推送通知 PUSH deviceToken

    服务器向客户端推送消息:      当应用程序推到后台,或者根本就没有运行(我们的代码无能为力)      如果这种情况之下,应用程序想和用户交互(传统的做法 不可能)      推送 APNS:Ap ...

  10. [转]在 .NET 中远程请求 https 内容时,发生错误:根据验证过程,远程证书无效

    该文原网址:http://www.cnblogs.com/xwgli/p/5487930.html 在 .NET 中远程请求 https 内容时,发生错误:根据验证过程,远程证书无效.   当访问 h ...