虚拟机磁盘扩容(parted、lvm)
1、虚拟化平台虚拟机添加硬盘系统查看添加的硬盘
# lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 50G 0 disk ├─sda1 8:1 0 1G 0 part /boot└─sda2 8:2 0 49G 0 part ├─centos-root 253:0 0 44G 0 lvm / └─centos-swap 253:1 0 5G 0 lvm sr0 11:0 1 4.4G 0 rom如果没有显示出来新加的硬盘,则执行下面命令
echo "- - -">/sys/class/scsi_host/host0/scan echo "- - -" >/sys/class/scsi_host/host1/scan echo "- - -" >/sys/class/scsi_host/host2/scan再次查询,发现新添加的sdb已经可以看到了。
# lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 50G 0 disk ├─sda1 8:1 0 1G 0 part /boot└─sda2 8:2 0 49G 0 part ├─centos-root 253:0 0 44G 0 lvm / └─centos-swap 253:1 0 5G 0 lvm sdb 8:16 0 50G 0 disk sr0 11:0 1 4.4G 0 rom
2、parted将sdb分区
# parted /dev/sdbGNU Parted 3.1使用 /dev/sdbWelcome to GNU Parted! Type 'help' to view a list of commands.(parted) mklabel gpt (parted) mkpart primary 0% 100% (parted) p Model: VMware Virtual disk (scsi)Disk /dev/sdb: 53.7GBSector size (logical/physical): 512B/512BPartition Table: gptDisk Flags: Number Start End Size File system Name 标志 1 1049kB 53.7GB 53.7GB primary(parted) q 信息: You may need to update /etc/fstab.#再次查看,发现主分区sdb1出现了
# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTsda 8:0 0 50G 0 disk ├─sda1 8:1 0 500M 0 part /boot└─sda2 8:2 0 49.5G 0 part ├─centos-root 253:0 0 47.5G 0 lvm / └─centos-swap 253:1 0 2G 0 lvm sdb 8:16 0 50G 0 disk └─sdb1 8:17 0 50G 0 part sr0 11:0 1 1024M 0 rom #
3 、查看现有vg,lv,确定扩容
# pvs PV VG Fmt Attr PSize PFree /dev/sda2 centos lvm2 a--
页:
[1]