Linux mounts the new disk to the root directory

  1. Add the disk to the machine that needs to be mounted

  2. lsblkCheck the hard disk mounting situation, sdb, sdc are my newly mounted disks

  3. fdisk -lView the partition status before mounting

  4. Create a partition for a new hard disk. fdisk /dev/sdb
    The terminal will prompt:
    Command (m for help): Input: n
    and then enter p and 1 in turn,
    and then the volume’s start address and end address will be prompted, keep the default and press Enter (meaning only Divide into one area)
    Enter "w" to save and launch

  5. Use fdisk -lthe view again, and /dev/sdb1 appears, indicating that the partition work is completed

  6. mkfs -t ext3 /dev/sdb1Format the new area

  7. lsblkList all available device block information

  8. vgdisplay -vView volume groups

  9. pvcreate /dev/sdb1create physical volume

  10. pvdisplayView creation results

  11. vgextend centos /dev/sdb1Extended volume group, where centosis the VG Name in step 8

  12. lvextend -L +256G /dev/centos/rootExtend Logical Volume

  13. df -hCheck the mounts, don't panic, haha

  14. xfs_growfs /dev/centos/rootsync file system

  15. df -hCheck the mounting status again, it has been OK

Guess you like

Origin blog.csdn.net/github_36665118/article/details/130529448