云平台及Redhat 相关操作

一. 磁盘相关

1.AWS 上磁盘扩容

(1). 步骤介绍

1.系统中确定需要扩的磁盘,命令:lsblk
注意:根据磁盘大小确定磁盘时,检查是否只有一块磁盘与需要扩的磁盘大小相同;多块时需要使用nvme list命令查看卷ID
2.在AWS上进行扩盘,选择EC2页面–>实例(根据ip查找实例)–>选择存储–>选择需要扩的磁盘的ID–>右键选择修改磁盘
注意:磁盘扩盘时只能增加不能缩小,因此必须谨慎扩盘
3.在系统中刷新磁盘:命令xfs_growfs 磁盘分区

扩展lvm空间
fdisk -l

fdisk 磁盘设备 如:fdisk /dev/sdb
p 打印当前磁盘分区情况
n 新建分区 LVM分区 修改分区ID为 8e
pvcreate 分区
pvdisplay 显示当前pv
—vg卷—
vgextend vg卷组名称 /dev/[分区名称]
vgcreate vg卷组名称 /dev/[分区名称]

—lvm卷—
lvcreate -L [接空间] -n [新建lv卷名称] [vg卷名称]
lvextend +[扩容空间大小] /dev/mapper/[lv卷名称]

lvm 挂载的时侯写分区
磁盘 写UUID

(2). 扩展LVM中的PV空间
[root@hostname ~]# fdisk /dev/nvme0n1
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): p
Disk /dev/nvme0n1: 66 GiB, 70866960384 bytes, 138412032 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
Disklabel type: dos
Disk identifier: 0x25b95398

Device         Boot   Start      End  Sectors Size Id Type
/dev/nvme0n1p1         2048     4095     2048   1M 83 Linux
/dev/nvme0n1p2         4096  2101247  2097152   1G 83 Linux
/dev/nvme0n1p3      2101248 20971486 18870239   9G 8e Linux LVM

Command (m for help): d
Partition number (1-3, default 3): 3

Partition 3 has been deleted.

Command (m for help): n
Partition type
   p   primary (2 primary, 0 extended, 2 free)
   e   extended (container for logical partitions)
Select (default p):

Using default response p.
Partition number (3,4, default 3): 3
First sector (2101248-138412031, default 2101248):
Last sector, +sectors or +size{K,M,G,T,P} (2101248-138412031, default 138412031):

Created a new partition 3 of type 'Linux' and of size 65 GiB.
Partition #3 contains a LVM2_member signature.

Do you want to remove the signature? [Y]es/[N]o: n

Command (m for help): p

Disk /dev/nvme0n1: 66 GiB, 70866960384 bytes, 138412032 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
Disklabel type: dos
Disk identifier: 0x25b95398

Device         Boot   Start       End   Sectors Size Id Type
/dev/nvme0n1p1         2048      4095      2048   1M 83 Linux
/dev/nvme0n1p2         4096   2101247   2097152   1G 83 Linux
/dev/nvme0n1p3      2101248 138412031 136310784  65G 83 Linux

Command (m for help): w
The partition table has been altered.
Syncing disks.

扩展完成后执行如下命令:
pvresize /dev/nvme0n1p3

2.Azure 上磁盘扩容

(1). 扩容

首先在Azure 平台上扩容磁盘,数据盘可以不停机的情况下扩容。
如果使用上述过程在不停机的情况下扩展了数据磁盘,则在重新扫描设备(通常只在启动过程中进行)之前,磁盘大小不会改变。
重新扫描设备:
fdisk -l /dev/sdx
在这里插入图片描述

  • 利用该命令进行重新扫描磁盘
    echo 1 | sudo tee
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值