在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
在Linux下用fdisk创建分区的更多相关文章
- Linux下使用fdisk扩展分区容量
导读 我们管理的服务器可能会随着业务量的不断增长造成磁盘空间不足的情况,比如:共享文件服务器硬盘空间不足,在这个时候我们就需要增加磁盘空间,来满足线上的业务:又或者我们在使用linux的过程中, 有时 ...
- Linux下useradd命令创建的用户不能登录的问题
Linux下useradd命令创建的用户不能登录的问题 问题: 用useradd命令新创建一个用户tester 密码pwdtest mkdir -p /home/tester(创建文件夹) user ...
- 《linux下进程的创建,执行,监控和终止》
<linux下进程的创建,执行,监控和终止> http://blog.csdn.net/miss_acha/article/details/43671047 http://blog.csd ...
- 在 Linux 下使用mdadm创建 RAID 5
在 RAID 5 中,数据条带化后存储在分布式奇偶校验的多个磁盘上.分布式奇偶校验的条带化意味着它将奇偶校验信息和条带化数据分布在多个磁盘上,这样会有很好的数据冗余. 在 Linux 中配置 RAID ...
- Linux磁盘及文件系统(二)Linux下磁盘命名和分区
在为主机添加硬盘之前,首先需要了解Linux系统下对硬盘和分区的命令方法 一.磁盘命名 Linux下对SCSI和SATA设备是以sd命名的,第一个SCSI设备是sda,第二个是sdb....以此类推. ...
- linux下给U盘分区&制作文件系统
这几天读到TLCL-Storage Media一节,不由的想要折腾一下U盘,一直以来U盘只是被拿来暂存数据,其内部有没有文件系统,数据怎么管理,那是从来也不清楚,本文就依葫芦画瓢,折腾下手中的King ...
- Linux下添加硬盘,分区,格式化详解
2005-10-17 在我们添加硬盘前,首先要了解linux系统下对硬盘和分区的命名方法. 在Linux下对IDE的设备是以hd命名的,第一个ide设备是hda,第二个是hdb.依此类推 我们一般主板 ...
- linux下磁盘查看和分区
4.1 df命令 4.2 du命令 4.3/4.4 磁盘分区 df命令df输出磁盘文件系统使用情况: [root@centos ~]# df文件系统 1K-块 已用 可用 已用% 挂载点 /dev/s ...
- centos下使用fdisk扩展分区容量大小
硬盘空间为20G,VMware增加磁盘大小,需要再增加10G空间 扩展完后,重启系统,再次使用fdisk -l查看,会发现硬盘空间变大了: 重新创建分区,调整分区信息 本次实验主要对/dev/sda4 ...
随机推荐
- 【待整理】PS切图基础教程
http://www.w3cfuns.com/article-442-1-1.html http://www.w3cfuns.com/article-443-1-1.html 其他专题研究: floa ...
- 130. Surrounded Regions -- 被某字符包围的区域
Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured ...
- qml支持多平台的编译--尤其对于需要支持xp的情况
http://www.oschina.net/p/deepin-boot-maker 系统支持: Windows平台: Windows 7/ Windows 8 需要安装显卡驱动 Windows XP ...
- 编写自己的Windows Live Writer插件
起因 自从小猪使用Windows Live Writer(wlw)来写博客之后就很少打开网站的后台编辑器了,这真是个写博客的好东西啊,但是任何东西都是不完美的.索契冬奥会开幕式都会把五环弄成四环呢!对 ...
- BroadcastReceiver的简介
BroadcastReceiver本质上属于一个监听器,因此实现BroadcastReceiver的方法只要重写BroadcastReceiver的onReceive(Context context ...
- Understanding Virtual Memory
Understanding Virtual Memory by Norm Murray and Neil Horman Introduction Definitions The Life of a P ...
- bzoj 2456: mode
#include<cstdio> #include<algorithm> using namespace std; int n,t,sum; int main() { scan ...
- 套汇问题 Floyd
问题:套汇. 思路:Floyd 代码: #include <cstdio> #include <cstdlib> #include <ctime> #define ...
- EntityFramework之创建数据库及基本操作(一)
那时学EF的时候还没有Code First,只有DB First,生成的是一个EDMX文件,Code First则没有这文件,下面直接上代码吧 数据库创建以及建表 1.首先我们新建一个新项目,使用Nu ...
- wp8.1 C#技巧: Data和ViewModel类编写
在Data.cs namespace PicApp { [DataContract] class DataItem : PropertyChangeNotification { public even ...