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 ...
随机推荐
- Power Designer 使用技巧总结
1.设置主键自增 在表的属性界面---选择column---双击主键: 2. 为脚本添加注释: 在表的属性界面---选择column分别进行下列设置:
- Activiti的Eclipse插件离线安装指南
原文地址:http://www.tuicool.com/articles/yUnURjy
- VC++下封装ADO类以及使用方法
操作系统:windows 7软件环境:visual studio 2008 .Microsoft SQL 2005本次目的:介绍一个已经封装的ADO类,简单说明怎么导入使用 首先声明一下,这个封装的A ...
- lunux下查看文件文件夹大小的命令
使用ls -lht命令显示当前目录下的所有文件,其中有一列就是显示这个文件的大小.如果要看一个文件夹的大小,可以用du -sh *
- Form.KeyPreview 属性2
在使用.Net Framework编写窗体应用程序的时候,有时有需要响应窗体的按键消息. 当窗体上没有任何其他控件的时候,窗体是可以直接响应这些消息的. 但是当窗体上有其他控件时,会发现窗体再也不会响 ...
- 【HDOJ】1241 Oil Deposits
经典的BFS. #include <stdio.h> #include <string.h> #define MAXNUM 105 #define MAXROW 105 #de ...
- Eclipse问题解决方案,不断更新
执行“software update”时出现:Error retrieving "feature.xml"... 执行“software update”时出现:Error retr ...
- poj3037
首先到每个点的速度实际上是一个定值,就是v0*2^(起点与当前点高度差) 所以当前点i到任意一个相邻点的时间都是一个定值, 不难想到构图最短路径 ..] ,,,); dy:..] ,,-, ...
- 创建通用型framework
http://years.im/Home/Article/detail/id/52.html http://www.cocoachina.com/industry/20131204/7468.html ...
- 【转】JNI学习积累之一 ---- 常用函数大全
原文网址:http://blog.csdn.net/qinjuning/article/details/7595104 本文原创,转载请注明出处:http://blog.csdn.net/qinjun ...