Workshop seventh day

First, prepare disk partitions

#fdisk /dev/sdb

 

 

 

 

#n create three partitions, respectively 1G. Note that when allocating memory + 1G

 

 

 

 

(Picture repeated three times)  

#t change the partition type to 8e

 

 

 

 

Finally, be sure to enter: "W" to save

II: Preparation physical volume

  • pvcreate /dev/sdb1
  •  pvcreate /dev/sdb2
  •  pvcreate /dev/sdb3
  • pvdisplay / pvs lists the current physical volume
  •  pvremove / dev / sdb3 not remove the physical volume is not wrong
  •  

     

     

Three: prepare the volume group

  • vgcreate vg1 /dev/sdb1 /dev/sdb2 /dev/sdb3
  •  

     

  •  vgdisplay / vgs volume groups listed
  •  

     

  •  
  •  

    Four: Creating a Logical Volume

  • lvcreate -L 200M -n lv1 vg1
  •  lvdisplay lists logical volumes
  •  

     

  •  Format mkfs.xfs / dev / vg1 / lv1, and mount
  •  lvremove / dev / vg1 / lv1 not delete the logical volume is not wrong

 

 

 

The / dev / vg1 / lv1 formatted to ext4 format; command: mkfs -t ext4 / dev / vg1 / lv1; otherwise, an error superblock

 

 

 

Five: the logical volume expansion

  • lvresize -L 300M / dev / vg1 / lv1 reset the volume size
  •  e2fsck -f / dev / vg1 / lv1 check for disk errors (ext4 execution)
  •  resize2fs / dev / vg1 / lv1 update the logical volume information (ext4 execution)
  •  xfs_growfs / dev / vg1 / lv1 xfs file system needs to be performed
  •  

    Six: reduced logical volume (xfs is not supported)

  • First umount to unmount
  •  e2fsck -f / dev / vg1 / lv1 check for disk errors (ext4)
  •  resize2fs / dev / vg1 / lv1 100M update the logical volume information (ext4)
  •  lvresize -L 100M / dev / vg1 / lv1 reset the volume size
  •  

    Seven: Extend Volume Group

  • fdisk / dev / sdb new / dev / sdb5 (logical partition 8e) 2G same procedure
  • Refresh again directory: #partprobe
  •  pvcreate /dev/sdb4
  •  vgextend vg1 /dev/sdb4
  •  lvresize -L 100M  /dev/vg1/lv1  重新设置卷大小
  •  

     

 

 

Guess you like

Origin www.cnblogs.com/315z/p/12045708.html