第四单元:管理系统中的简单分区和文件系统
一、添加文件系统空间
简单分区和文件系统1.认识
1> 存储是每个计算机系统的基本需求。 Red Hat EnterpriseLinux 提供了一些强大的工具 , 它们能在大量的场景中管理多种类型的存储设备
2> disk 是用于管理磁盘分区的实用程序。您可以通过选择 -l选项和指定磁盘名称 ( fdisk -cul /dev/vda ) 运行该实用程序 , 以查看磁盘及其分区。您可以通过交互式地运行该实用程序 , 并选择相应的菜单选项 ( fdisk -cu /dev/vda ) 进行更改。 -c 禁用旧的 DOS 兼容模式 , -u 以扇区 ( 而不是柱面 , 已经过时 ) 的格式显示输出
xiaot
3> 查看系统设备信息
• fdisk -l
显示系统中所有可以使用的设备信息
• blkid
显示系统正在使用的设备 id
2.添加新设备
1> 新建分区
[root@localhost ~]# fdisk /dev/vdb ##进入/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.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x115e3020.
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 (0 primary, 0 extended, 4 free)##主分区,最多可以有四个主分区
e extended ##扩展分区,扩展分区内部如容器一般,在里边会建立逻辑分区
Select (default p): p ##建立新的主分区
Partition number (1-4, default 1): 1 ##选择建立1号主分区
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): p ##显示当前分区情况
Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
D