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.将文件 ...
随机推荐
- github帐户和仓库的创建
sign up is registration and sign in is logging in for "in" is to enter an existing account ...
- how do I get the difference between two R named lists?
aa<- list(a=1, b="two", c=list(3, "four")) bb <- list(a=1, c=list(3, " ...
- Codeforces Round #535 (Div. 3) 解题报告
CF1108A. Two distinct points 做法:模拟 如果两者左端点重合就第二条的左端点++就好,然后输出左端点 #include <bits/stdc++.h> usin ...
- HIHOcoder 1457 后缀自动机四·重复旋律7
思路 后缀自动机题目,题目本质上是要求求出所有不同的子串的和,SAM每个节点中存放的子串互不相同,所以对于每个节点的sum,可以发现是可以递推的,每个点对子节点贡献是sum[x]*10+c*sz[x] ...
- springBoot 全局异常捕捉
package cn.com.cs.core.exception; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import or ...
- facebook api之Access Tokens之Business Manager System User
Business Manager System User Make programatic, automated actions on ad objects or Pages, or do progr ...
- 转载:避免重复插入,更新的sql
本文章来给大家提供三种在mysql中避免重复插入记录方法,主要是讲到了ignore,Replace,ON DUPLICATE KEY UPDATE三种方法,各位同学可尝试参考. 案一:使用ignore ...
- Linux学习之用户与root
因为想要建立建立一个目录,但是发现权限不够,因为没用root登陆,所以学习了一下普通用户与root之间如何切换以及如何创建用户的一些知识. 1.pwd命令可以查看当前用户 $这个符号代表的就是普通用户 ...
- _gift
time 本次上线后在线时长,单位:秒 rewId 奖励模板ID,对应_rew表中rewId notice 弹窗内容,为空不弹窗
- win10常用命令和设置总结
1.常用命令 exit:退出cmd面板; cls:清除cmd面板; 2.常用设置 2.1 services.msc 禁用:以后怎样都不会运行;手动:是打开某些用到它的程序要用到该服务时才会运行; 自动 ...