LVM扩容

LVM扩容

  1. 分区基本结构
lsblk

NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sr0           11:0    1 335.6M  0 rom  
vda          252:0    0    63G  0 disk 
├─vda1       252:1    0   500M  0 part /boot
└─vda2       252:2    0  61.5G  0 part 
  ├─xxx-root 253:0    0  57.6G  0 lvm  /
  └─xxx-swap 253:1    0   3.9G  0 lvm  [SWAP]
vdb          252:16   0    20G  0 disk 
└─vdb1       252:17   0    20G  0 part /path/of/mount
  1. parted /dev/vda

    (parted) print #打印分区信息,大概如下:
     Model: Virtio Block Device (virtblk)
     Disk /dev/vda: 67.6GB
     Sector size (logical/physical): 512B/512B
     Partition Table: msdos
     Disk Flags: 
    
     Number  Start   End     Size    Type     File system  标志
     1      1049kB  525MB   524MB   primary  ext4         启动
     2      525MB   66.6GB  66.0GB  primary               lvm
    
    (parted) resizepart 2 #调整想要调整的分区,2对应上面的Number值; 
                            #当出现提示结束点时,比如:结束点?  [64.4GB]? 
                            #此时默认的值是当前分区的大小,要扩大就要输入新的值
                            #该值一般就取print输出的Disk大小 (如:Disk /dev/vda: 67.6GB)
    
    (parted) quit         #退出parted
    
  2. partprobe

  3. pvresize /dev/vda2

  4. lvresize -l +100%FREE /dev/xxx/root

  5. resize2fs /dev/xxx/root

你可能感兴趣的:(Reference,Unix_Linux,Read_Notes)