linux用fdisk创建分区,在Linux下用fdisk创建分区
一、输入 fdisk -l /dev/sda ,观察硬盘之实体使用情形。
二、输入 fdisk /dev/sda,可进入分割硬盘模式。
1. 输入 m 显示所有命令列示。
2. 输入 p 显示硬盘分割情形。
3. 输入 a 设定硬盘启动区。
4. 输入 n 设定新的硬盘分割区。
4.1. 输入 e 硬盘为[延伸]分割区(extend)。
4.2. 输入 p 硬盘为[主要]分割区(primary)。
5. 输入 t 改变硬盘分割区属性。
6. 输入 d 删除硬盘分割区属性。
7. 输入 q 结束不存入硬盘分割区属性。
8. 输入 w 结束并写入硬盘分割区属性
实例:
(1)进入fdisk界面,列出所有命令
#fdisk /dev/sda
(2)m:显示所有在fdisk中使用的命令
Command (m for help):m
(3)p:显示硬盘分区信息
Command (m for help):p
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0x0000f797
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 287 2097152 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 287 2611 18668544 83 Linux
说明:
Device Boot(引导):表示引导分区
Start(开始):表示一个分区从哪个柱面开始
End(结束):表示一个分区到哪个柱面结束
Blocks(容量):表示分区容量,单位KB
Id和System:确认分区类型
(4)创建和删除主分区、扩展分区和逻辑分区
Command (m for help): n
Command action
e extended //扩展分区
p primary partition (1-4) //主分区
p
Selected partition 4
有扩展分区和主分区,逻辑分区在扩展分区中建立。注意到括号中的1-4,最多只能建四个主分区(包括扩展分区)。先建一个主分区:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p #建主分区
Partition number (1-4): 1 #分区号为1
First cylinder (1-2610, default 1): #直接回车默认从第一个柱面开始划分
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): +2G #加空间大小,这里有很多种选择:+后面单位可以接M,G,K(记得要大写)表示划分你所加的空间,也可以是柱面数。不管怎样都不能超过该磁盘剩余的空间否则无效。
Command (m for help): p #分好后查看分区信息,刚所做的所有一目了然。
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0xfaa2aa49
Device Boot Start End Blocks Id System
/dev/sdb1 1 262 2104483+ 83 Linux
同上所述建立扩展分区:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e #建立扩展分区
Partition number (1-4): 4
First cylinder (263-2610, default 263):
Using default value 263
Last cylinder, +cylinders or +size{K,M,G} (263-2610, default 2610): +4G
Command (m for help): p
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0xfaa2aa49
Device Boot Start End Blocks Id System
/dev/sdb1 1 262 2104483+ 83 Linux
/dev/sdb4 263 785 4200997+ 5 Extended
扩展分区建好我们就可以在扩展分区建立逻辑分区了
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l #建逻辑分区
First cylinder (263-785, default 263):
Using default value 263
Last cylinder, +cylinders or +size{K,M,G} (263-785, default 785): +2G
Command (m for help): p
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0xfaa2aa49
Device Boot Start End Blocks Id System
/dev/sdb1 1 262 2104483+ 83 Linux
/dev/sdb4 263 785 4200997+ 5 Extended
/dev/sdb5 263 524 2104483+ 83 Linux
上面显示已经建好一个主分区,一个逻辑分区,但是这些现在还没有生效我们需要保存退出。
Command (m for help): w #保存退出
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@bogon 桌面]# fdisk -l
Disk /dev/sda: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 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: 0x000471ad
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 3851 30720000 83 Linux
/dev/sda3 3851 4106 2048000 82 Linux swap / Solaris
/dev/sda4 4106 10444 50912256 5 Extended
/dev/sda5 4106 10444 50911232 83 Linux
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0xfaa2aa49
Device Boot Start End Blocks Id System
/dev/sdb1 1 262 2104483+ 83 Linux
/dev/sdb4 263 785 4200997+ 5 Extended
/dev/sdb5 263 524 2104483+ 83 Linux
来源:https://www.cnblogs.com/Y-HKL/p/5851164.html
linux用fdisk创建分区,在Linux下用fdisk创建分区相关推荐
- xp系统打开计算机硬盘分区,XP系统下怎么进行硬盘分区啊?
XP系统盘本身带有分区功能,支持FAT.FAT32.NTFS格式.所以在xp系统盘启动计算机后,不能进行DOS分区.xp盘启动计算机后,按照安装向导指示,系统会要求你选择系统安装的分区或者重新分区,这 ...
- win8 linux分区工具,Ubuntu下挂载Win8磁盘分区
最近装了个Ubuntu系统,但是一番折腾后发现除了分给Ubuntu的磁盘分区外其他的Win8下磁盘分区都无法访问,在网上找了很多解决方案,但都无法最终解决.经过查阅资料,终于将问题迎刃而解. 问题描述 ...
- IDEA创建java项目src下没有办法创建包文件/MAVEN模块名变灰且模块多道横杠
1.IDEA中的java项目src下无法创建包文件 原因:这是因为该项目的src文件夹不是源文件夹 解决方法:需右键该文件夹,选择标记->源根 2.MAVEN模块名变灰且模块多道横杠 原因:ap ...
- src下创建java文件_Eclipse下maven项目创建src/main/java 源文件夹报错文件文件已存在问题...
标签: 一:选定: 二 选择jre system library选项 三 选择修改jre到默认 修改过后,应该就会自动补充了确实的文件了. 附加: src/main/java 存放项目的 ...
- linux系统新硬盘格式化,Linux系统下添加新硬盘分区格式化相关步骤介绍
预备知识 在我们添加硬盘前,首先要了解linux系统下对硬盘和分区的命名方法. 在Linux下对IDE的设备是以hd命名的,第一个ide设备是hda,第二个是hdb.依此类推 我们一般主板上有两个ID ...
- linux 分区 var,Ubuntu下移动/var目录到单独分区后出现的一些问题
Ubuntu下移动/var目录到单独分区后出现的一些问题 发布时间:2008-04-21 01:17:50来源:红联作者:yibin 如mount: special device /var/run d ...
- linux 程序更新使用U盘,linux下如何使用U盘?
昨天花了整整一天才把linux搞定,今天兴致勃勃地要把U盘上的文件拷贝过去.因为听同事说可以像在windows下那样直接双击使用U盘,于是照做了,哪曾想等了半天愣是没反应,最后还是提示错误,看来情报有 ...
- linux 怎样给磁盘命名,在Linux操作系统中磁盘是如何命名的
以下转自ITeye~~~~ 在Linux下对IDE的设备是以hd命名的,第一个ide设备是hda,第二个是hdb.依此类推 一般主板上有两个IDE接口,一共可以安装四个IDE设备.主IDE上的两个设备 ...
- linux lvm添加磁盘,Linux下添加磁盘创建lvm分区
shell> fdisk /dev/xvdb #### 选择磁盘 Command (m for help): m #### 帮助 Command action a toggle a bootab ...
最新文章
- 在Hibernate中处理批量更新和批量删除
- Ubuntu14.04重启网卡不生效
- 脑机接口主流算法解析课程视频汇总
- 如何在微信小程序中使用iconfont
- wifi无线网卡移植到andorid
- `Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
- 4、MySQL创建数据库(CREATE DATABASE语句)
- Python教程:Sys 与 Import 模块
- 重庆邮电大学发布2021年最新小样本目标检测综述
- JAVA实现WC.exe功能
- PHP base64
- java中如何做模糊查询_到底Java里的模糊查询语句该怎么写
- HDU - 1495 - 非常可乐
- 机器学习十大经典算法之AdaBoost
- java中的servlet_关于JavaWeb中Servlet的总结
- 【详细】嵌入式软件学习问题汇总(二)何为ARM(那些你得知道的事)?
- stagefright
- java下载excel模板文件
- 详解CAN 2.0协议
- C语言99乘法口诀函数,99乘法口诀妙用C语言输出