linux 系统磁盘分区之fdisk
对于学习磁盘分区,通常学习的都是fdisk命令
当然,对于小于2TB的磁盘,我们基本上是使用fdisk命令进行分区
下面就简单介绍一下fdisk操作磁盘的基本命令和场景模拟
常用命令介绍
fdisk -l 查看所有磁盘信息
fdisk /dev/sdb 使用fdisk命令工具操作/dev/sdb磁盘
m 显示所有的命令信息、用法
p 显示分区信息
q 退出
w 保存分区信息,只有执行了w命令后才会把分区信息写入到磁盘
d 1 删除磁盘的第一个分区
场景模拟
有一个1G的磁盘/dev/sdb
分区为一个主分区,一个扩展分区,大小都为200M
其中在扩展分区上面建立一个100M的逻辑分区 /dev/sdb5
格式化文件系统为 mkfs.ext4
实现开机自动挂载到目录 /backup3
1 使用fdisk命令工具操作磁盘/dev/sdb
fdisk /dev/sdb
2 创建一个主分区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-130, default 130): +400M
Command (m for help): p
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: 0x0004a98a
Device Boot Start End Blocks Id System
/dev/sdb1 1 52 417658+ 83 Linux
3 创建一个扩展分区
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e
Partition number (1-4): 2
First cylinder (53-130, default 53):
Using default value 53
Last cylinder, +cylinders or +size{K,M,G} (53-130, default 130): +400M
Command (m for help): p
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: 0x0004a98a
Device Boot Start End Blocks Id System
/dev/sdb1 1 52 417658+ 83 Linux
/dev/sdb2 53 104 417690 5 Extended
4 创建一个逻辑分区
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (53-104, default 53):
Using default value 53
Last cylinder, +cylinders or +size{K,M,G} (53-104, default 104): +100M
Command (m for help): p
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: 0x0004a98a
Device Boot Start End Blocks Id System
/dev/sdb1 1 52 417658+ 83 Linux
/dev/sdb2 53 104 417690 5 Extended
/dev/sdb5 53 66 112423+ 83 Linux
5 保存
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
6 对磁盘进行分区
[root@hsj2 ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
104448 inodes, 417656 blocks
20882 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67633152
51 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@hsj2 ~]# mkfs.ext4 /dev/sdb5
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
28112 inodes, 112420 blocks
5621 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
14 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
ok,搞定
linux 系统磁盘分区之fdisk的更多相关文章
- Linux系统磁盘分区、删除分区、格式化、挂载、卸载、开机自动挂载的方法总结
Linux系统按照MBR(Master Boot Record)传统分区模式: 注意:传统的MBR(Master Boot Record)分区方式最大只能分2T容量的硬盘,超过2T的硬盘一般采用GPT ...
- [转]linux系统磁盘分区之parted
转自:http://blog.csdn.net/h249059945/article/details/12668793 对于linux的分区通常可以使用fdisk命令工具和parted工具对于分区表通 ...
- linux系统磁盘分区之parted
对于linux的分区通常可以使用fdisk命令工具和parted工具 对于分区表通常有MBR分区表和GPT分区表 对于磁盘大小小于2T的磁盘,我们可以使用fdisk和parted命令工具进行分区 对于 ...
- 3. Linux系统磁盘分区介绍
1. 磁盘分区基本知识 1)磁盘在使用前一般要先分区(相当于建房子要分房间一样). 2)磁盘分区一般有主分区.扩展分区和逻辑分区之分.一块磁盘最多可以有4个主分区,其中一个主分区的位置可以用一个扩展分 ...
- Linux系统磁盘与分区管理(7)
Linux最传统的磁盘文件系统(filesystem)使用的是EXT4格式,所以要了解文件系统就得要由认识EXT4开始,而文件系统是创建在硬盘上面的,因此我们得了解硬盘的物理组成才行,下面我们回来详细 ...
- Linux学习笔记(4)磁盘分区(fdisk)、挂载与文件系统命令
Linux学习笔记(4)磁盘分区(fdisk).挂载与文件系统命令 1.磁盘分区是怎么表示的? 1.1 对于IDE接口,第一主盘为hda,第1从盘为hdb,第1从盘的第1个分区为hdb1 1.2 对于 ...
- linux 系统磁盘管理(主分区和逻辑分区)
摘要:linux系统磁盘管理主分区和逻辑分区 1.linux系统分区应了解的常识 硬盘分区实质上是对硬盘的一种格式化,然后才能使用硬盘保存各种信息,在创建分区时,就已经设置好了硬盘的各项物理参数,指定 ...
- Linux下磁盘分区挂载
一般你去买vps都会看到介绍说硬盘多少G 比如 80G 但是你进入系统df -h的时候发现怎么只有10G呢, 其实这10G是用来装系统的和一些常用服务软件的 不是给你放网站数据的 那50G硬盘在哪 ...
- Linux中磁盘分区——理论篇
Linux中磁盘分区——理论篇 现在主流的分区的方式有两种——MBR分区和GPT分区,本文将着重介绍MBR分区底层原理,及用相关命令验证相关原理 Linux中磁盘分区理论篇 为什么要对磁盘进行分区 M ...
随机推荐
- 查看jdk的位数
public class Test { public static void main(String[] args) { System.out.println("bit of JVM is ...
- pmtest1.asm pmtest2.asm pmtest5.asm 这几个比较重要.
读代码时注意Label后面的文字:desc表示是描述符,seg表示是段 pmtest1.asm 主要讲进入保护模式 http://www.cnblogs.com/wanghj-dz/archive/2 ...
- cocos2d-html5 Layer 和 Scene 创建模式
var myLayer = cc.Layer.extend({ init:function() {//2 界面 var bRet = false; if (this._super()) { bRet ...
- USB 枚举过程详解
Windows 对USB设备的枚举过程流程图如图1所示: 图1 WP8的USB功能只支持一个配置,三个接口,也就是分别有如下的字段: 设备描述符的bNumConfigurations=1, 配置描述符 ...
- x+2y+3z=n的非负整数解数
题目:给一个正整数n,范围是[1,10^6],对于方程:x+2y+3z = n,其中x,y,z为非负整数,求有多少个这样的三元组 (x,y,z)满足此等式. 分析:先看x+2y=m,很明显这个等式的非 ...
- 《C#并行编程高级教程》第7章 VS2010任务调试 笔记
没有什么好说的,主要是将调试模式下的Parallel Tasks窗体和Parallel Stacks窗体.折腾一下应该比看书效果好.(表示自己没有折腾过) 另外值得注意的是,主线程不是一个任务.所以主 ...
- CSS和JS标签style属性对照表
盒子标签和属性对照 CSS语法(不区分大小写) JavaScript语法(区分大小写) border border border-bottom borderBottom border-bottom-c ...
- geoserver 安装 sql server 插件
Did you download and install the sql server plugin as well? http://downloads.sourceforge.net/proje ...
- BZOJ2005: [Noi2010]能量采集 莫比乌斯反演的另一种方法——nlogn筛
分析:http://www.cnblogs.com/huhuuu/archive/2011/11/25/2263803.html 注:从这个题收获了两点 1,第一象限(x,y)到(0,0)的线段上整点 ...
- javaweb之javascript结合(三)
1.案例一:在末尾添加节点 第一步:获取到ul标签 第二步:创建li标签 document.createElement("标签名称")方法 第三步:创建文本 document.cr ...