如何在Redhat中调整LVM大小

我有一个虚拟机,Redhat 6.8最初是以一个60GB的磁盘开始的1.在VMware中,我把它的大小增加到了100GB。 我想将/ tmp卷从2GB增加到5GB。 我假设我需要先调整sda2分区,然后增加LV。 我试过echo 1 > /sys/class/scsi_device/2\:0\:0\:0\/device/rescan然后resize2fs /dev/sda但是表示它很忙。 不知道我需要什么命令或什么命令是…这是我的系统信息 –

 $ fdisk -l /dev/sda Disk /dev/sda: 107.4 GB, 107374182400 bytes 255 heads, 63 sectors/track, 13054 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0000555c Device Boot Start End Blocks Id System /dev/sda1 * 1 26 204800 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 26 7833 62708736 8e Linux LVM 

 $ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sr0 11:0 1 3.6G 0 rom sda 8:0 0 100G 0 disk ├─sda1 8:1 0 200M 0 part /boot └─sda2 8:2 0 59.8G 0 part ├─system-swap (dm-0) 253:0 0 10G 0 lvm [SWAP] ├─system-root (dm-1) 253:1 0 10G 0 lvm / ├─system-opt (dm-2) 253:2 0 10G 0 lvm /opt ├─system-tmp (dm-3) 253:3 0 2G 0 lvm /tmp ├─system-var_log (dm-4) 253:4 0 1G 0 lvm /var/log ├─system-var (dm-5) 253:5 0 10G 0 lvm /var ├─system-home (dm-6) 253:6 0 10G 0 lvm /home └─system-var_log_audit (dm-7) 253:7 0 1G 0 lvm /var/log/audit 

 $ lvdisplay /dev/system/tmp --- Logical volume --- LV Path /dev/system/tmp LV Name tmp VG Name system LV UUID QOy6T3-vVnK-fJ0o-hyfY-gPYf-IC61-YDLQn1 LV Write Access read/write LV Creation host, time hardlogs.localdomain, 2014-02-19 12:09:47 -0500 LV Status available # open 1 LV Size 2.00 GiB Current LE 512 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:3 

分区大小调整后,应重新启动系统,以确保内核能够识别新的大小。 之后:

  • 您必须调整LVM卷的大小,发出lvextend /dev/system/tmp -L 5G
  • 你必须调整文件系统的大小,发出resize2fs /dev/system/tmp

请注意对正确的设备发出上述命令。 例如,以前的resize2fs是简单而危险的错误,因为您不能使用sda作为目标,而是使用LVM卷。