磁盘管理1--磁盘分区

1.名词解释

分区方式: mbr(bootloader引导程序446字节,mpt主分区表64字节,55a硬盘标识2字节)、gpt
主分区
扩展分区
逻辑分区

2.磁盘查看命令

fdisk -l ##系统中的所有磁盘设备
df -Th ##系统正在挂载的磁盘设备
blkid ##系统可以挂载的磁盘设备id
这里写图片描述

3.分区划分

fdisk   /dev/vdb  ##建立磁盘分区

[root@localhost ~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

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 ##删除分区
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
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): n ##新建分区
Partition type:
p primary (1 primary, 0 extended, 3 free) ##分区类型为主分区
e extended ##分区类型为扩展分区
Select (default p): p
Partition number (1-4, default 1): 1 ##主分区id
First sector (2048-20971519, default 2048): ##此分区的起始位置
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): +100M ##分区大小
Partition 1 of type Linux and of size 100 MiB is set

Command (m for help): wq ##保存并退出,只输入q则表示放弃更改退出
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]#

partprobe   ##同步分区表
cat /proc/partitions  ##查看系统识别的分区信息
mkfs.xfs /dev/vdb1  ##格式化(安装文件系统)
mount /dev/vdb1  /mnt   ##临时挂载

这里写图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值