Linux中磁盘mbr分区——实践篇
Linux中磁盘mbr分区——实践篇
fdisk命令
语法
fdisk(选项)(参数)
选项
-b <分区大小> 指定每个分区的大小
-l 列出分区表信息
-v 显示版本信息
参数
设备文件:例如/dev/sda
实例
选择要操作的磁盘:
[root@vathe ~]#fdisk /dev/sdb
输入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 # 该表分区的系统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): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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: 0x48283ee0
Device Boot Start End Blocks Id System
新建分区表:
Command action #选择新增分区类型
e extended #扩展分区
p primary partition (1-4) #主分区
p // 键入p
Partition number (1-4): 1 // 键入1
First cylinder (1-1305, default 1): # 选择分区起点柱面
Using default value 1 //选择默认1
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305): +1G #设置分区大小1G,+表示往起点后添加,-表示往起点前添加分区
查看确认分区创建成功:
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes # 磁盘总大小 10.7GB
255 heads, 63 sectors/track, 1305 cylinders # 255个磁头,每个磁道63个扇区,1305个圆柱面
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: 0x48283ee0
Device Boot Start End Blocks Id System
/dev/sdb1 1 132 1060258+ 83 Linux
再建立一个扩展分区
Command (m for help): n
Command action e extended p primary partition (1-4) e Partition number (1-4): 4 # 分区号 First cylinder (133-1305, default 133): 900
Last cylinder, +cylinders or +size{K,M,G} (900-1305, default 1305): +500M # 扩展分区500M
在扩展分区中创建逻辑分区
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4) l
First cylinder (900-964, default 900):
Using default value 900 Last cylinder, +cylinders or +size{K,M,G} (900-964, default 964): +100M # 逻辑分区100M
查看分区列表
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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: 0x48283ee0
Device Boot Start End Blocks Id System
/dev/sdb1 1 132 1060258+ 83 Linux
/dev/sdb4 900 964 522112+ 5 Extended
/dev/sdb5 900 913 112423+ 83 Linux
保存退出
Command (m for help): w # 保存退出
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
查看
[root@vathe ~]#lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 3.7G 0 rom
sda 8:0 0 200G 0 disk
├─sda1 8:1 0 200M 0 part /boot
├─sda2 8:2 0 20G 0 part /data
├─sda3 8:3 0 10G 0 part /home
├─sda4 8:4 0 1K 0 part
├─sda5 8:5 0 2G 0 part [SWAP]
└─sda6 8:6 0 167.8G 0 part /
sdb 8:16 0 10G 0 disk # 显示分区成功
├─sdb1 8:17 0 1G 0 part
├─sdb4 8:20 0 1K 0 part
└─sdb5 8:21 0 109.8M 0 part
分区成功,当然,要使用磁盘,还需要进行两部操作,才能使用磁盘——将磁盘挂载在具体目录(或文件),和对个分区进行格式化。
Linux中磁盘mbr分区——实践篇的更多相关文章
- Linux中磁盘分区——理论篇
Linux中磁盘分区——理论篇 现在主流的分区的方式有两种——MBR分区和GPT分区,本文将着重介绍MBR分区底层原理,及用相关命令验证相关原理 Linux中磁盘分区理论篇 为什么要对磁盘进行分区 M ...
- Linux 磁盘空间查询&&解决Linux 中“磁盘空间不足”的问题
一.linux 查看目录的剩余空间大小 两个命令df .du结合比较直观 df -h 查看整台服务器的硬盘使用情况 du -lh --max-depth=1 : 查看当前目录下一级子文件和子目录占用的 ...
- linux中增加swap分区文件的步骤方法
一.swap交换分区 Swap分区在系统的物理内存不够用的时候,把硬盘空间中的一部分空间释放出来,以供当前运行的程序使用.那些被释放的空间可能来自一些很长时间没有什么操作的程序,这些被释放的空间被临 ...
- linux下磁盘进行分区、文件系统创建、挂载和卸载
任务的原因:由于,刚购买来的服务器需要将磁盘挂载到操作系统上,为了挂载磁盘首先要对磁盘进行分区,然后进行文件系统的创建,最后将磁盘挂载到操作系统上的某个目录. MBR(Master Boot Reco ...
- Linux系统磁盘与分区管理(7)
Linux最传统的磁盘文件系统(filesystem)使用的是EXT4格式,所以要了解文件系统就得要由认识EXT4开始,而文件系统是创建在硬盘上面的,因此我们得了解硬盘的物理组成才行,下面我们回来详细 ...
- linux下磁盘进行分区、文件系统创建、挂载和卸载(转)
任务的原因:由于,刚购买来的服务器需要将磁盘挂载到操作系统上,为了挂载磁盘首先要对磁盘进行分区,然后进行文件系统的创建,最后将磁盘挂载到操作系统上的某个目录. MBR(Master Boot Reco ...
- 如何在Linux 中获取硬盘分区或文件系统的UUID?
作为一个 Linux 系统管理员,你应该知道如何去查看分区的 UUID 或文件系统的 UUID.因为现在大多数的 Linux 系统都使用 UUID 挂载分区.你可以在 /etc/fstab 文件中可以 ...
- Linux下的MBR分区
MBR分区 下面讲一讲如何给一块新添加入服务器的硬盘做MBR分区,那么为什么叫做MBR分区呢?后面会讲 做MBR分区,使用系统自带的fdisk工具.先看一看什么是fdisk,在命令行输入“fdisk” ...
- Linux中磁盘管理与三剑客之awk初识
昨日内容回顾 1.用两种方法实现 将文件中以 # 开头的行 把 # 去掉 sed -r 's/^ *#//g' /etc/fstab cat /etc/fstab | tr -d '^#' 2.将文件 ...
随机推荐
- bzoj 3437 小p的农场
bzoj 3437 小p的农场 思路 \(f[i]=min(f[j]+\sum\limits_{k=j+1}^{i}{b[k]*(i-k)}+a[i])\) \(f[i]=min(f[j]+\sum\ ...
- A^B mod C (快速幂+快速乘+取模)题解
A^B mod C Given A,B,C, You should quickly calculate the result of A^B mod C. (1<=A,B,C<2^63). ...
- 数据库04_SQL简单实践
笔试实例 以MySQL为例,制作一个简单的表profit如下: T1 分别求1991年以及1992年第一季度的金额总和,效果如下: sql语句实现: SELECT year, SUM(amount) ...
- Asp.net MVC 控制器ActionResult的例子
ActionResult 父类型 ViewResult View() 多重载应用 PartialViewResult PartialView() 部分试图 New EmptyResult() 空 如 ...
- 论文笔记:ReNet: A Recurrent Neural Network Based Alternative to Convolutional Networks
ReNet: A Recurrent Neural Network Based Alternative to Convolutional Networks2018-03-05 11:13:05 ...
- mysql表分区存储过程
本文为博主原创,未经允许不得转载: 由于数据库一张表数据量有几千万条,而且在不断增长,看见公司前辈写了一个创建表分区的存储过程,感觉 甚是牛逼,在此供自己保留学习. /*PROCEDURE creat ...
- git服务器搭建全程
为了后续安装能正常进行,我们先来安装一些相关依赖库和编译工具 [root@VM_95_113_centos ~]# yum install curl-devel expat-devel gettext ...
- 【Python】【有趣的模块】【sys&time&os】
[模块] sys.path.append('C:/Users/wangxue1/PycharmProjects/selenium2TestOne') 然后就可以直接import 这个路径下的模块了 [ ...
- 启动tomcat 报错:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
[root@localhost META-INF]# systemctl start tomcat Job for tomcat.service failed because the control ...
- Linux运维人员最常用 150 个命令汇总
linux 命令是对 Linux 系统进行管理的命令.对于 Linux 系统来说,无论是中央处理器.内存.磁盘驱动器.键盘.鼠标,还是用户等都是文件, Linux 系统管理的命令是它正常运行的核心,与 ...