ev/testvg/vo
/dev/testvg/vo: UUID="fe323058-93db-428d-883c-2c0210cd10c6" TYPE="xfs"
[root@serverb ~]# vim /etc/fstab
UUID="fe323058-93db-428d-883c-2c0210cd10c6" /mnt/vo xfs defaults 0 0
[root@serverb ~]# mkdir /mnt/vo
[root@serverb ~]# mount -a
[root@serverb ~]# df -h #查看200M的Size
实际操作
[root@serverb ~]# lvextend -L 300M /dev/testvg/vo
[root@serverb ~]# lvs
[root@serverb ~]# df -h #发现没有修改成功
扩展文件系统,ext类型的文件系统用resize2fs /dev/testvg/vo ,后?接的是逻辑卷的路径。
[root@serverb ~]# xfs_growfs /mnt/vo #后面接的是挂载点的路径
[root@serverb ~]# xfs_growfs /dev/testvg/vo #后面接绝对路径也可
[root@serverb ~]# df -h
二十、添加交换分区
在系统上添加?个512MiB的交换分区,设置交换分区应在系统启动时自动挂载,不要
删除或修改系统上已存在的交换分区。
注意:要使用/dev/vdb创建一个主分区,改变分区类型为82,其余所有/dev/vdb的空间分给扩展分区,在其上分逻辑分区。
[root@serverb ~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): e #分成扩展分区
Partition number (2-4, default 2):
First sector (4196352-10485759, default 4196352):
Last sector, +sectors or +size{K,M,G,T,P} (4196352-10485759, default 10485759):
Created a new partition 2 of type 'Extended ' and of size 3 GiB.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
First sector (2048-10485759, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (4196352-10485759, default 10485759): +512M
Created a new partition 5 of type 'Linux' and of size 512 MiB.
Command (m for help): l
找到82的类型
Command (m for help): t
Partition number ( 1,2,5,default 5):
Hex code (type L to list all codes):82
Changed type od partition 'Linux' to 'Linux swap / Solaris'.
Command (m for help): p
Command (m for help): w
The partition table has been altered.
Syncing disks.
Failed to add partition 5 to system: Device or resource busy
#如果报错说无法加载或者无法读取,就reboot重启,重新读取
[root@serverb ~]# mkswap /dev/vdb5 #格式化
[root@serverb ~]# blkid /dev/vdb5 #查看uuid
/dev/vdb5: UUID="f626f11c-4363-4caf-aba6-5a418ea04079" TYPE="swap"
PARTUUID="ae75bf0a-02"
[root@serverb ~]# vim /etc/fstab #写入永久挂载
UUID=f626f11c-4363-4caf-aba6-5a418ea04079 swap swap defaults 0 0
[root@serverb ~]# free -m #查看有没有swap分区
[root@serverb ~]# swapon -a #打开swap
[root@serverb ~]# free -m #查看
[root@serverb ~]# swapon -s
#free -m 比较直观查看swap
Filename Type Size Used Priority
/dev/vdb2 partition 524284 0 -2
二十一、创建逻辑卷
根据以下要求,创建新的逻辑卷:
1.逻辑卷的名字为mylv,属于myvg卷组,大小为50个pe
2.卷组myvg中的逻辑卷的pe大小应当为16MiB
3.使用vfat文件系统将逻辑卷mylv格式化
4.此逻辑卷应当在系统启动时自动挂载到/mnt/mydata目录下
[root@serverb ~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
All space for primary partitions is in use.Adding logical partition 6
First sector (5249024-10485759,default 5249024):
Last sector,+sectors or +size{K,N,6,T,P} (5249024-10485759,default 10485759):+816M
created a new partition 6 of type 'Linux' and of size 816 MiB.
Command (m for help): t
Partition number ( 1,2,5,default 5):
Hex code (type L to list all codes):8e
Command (m for help): p
Disk /dev/vdb: 5 GiB,5368709120 bytes,10485760 s