• Linux给根目录扩容


    需求:Linux系统挂载到根目录的磁盘空间满了,如何扩容?
    一、添加磁盘并分区

    [root@cdn ~]# fdisk /dev/sdb
    
    Welcome to fdisk (util-linux 2.37.2).
    Changes will remain in memory only, until you decide to write them.
    Be careful before using the write command.
    
    Device does not contain a recognized partition table.
    Created a new DOS disklabel with disk identifier 0xf1212eee.
    
    Command (m for help): n
    Partition type
       p   primary (0 primary, 0 extended, 4 free)
       e   extended (container for logical partitions)
    Select (default p):
    
    Using default response p.
    Partition number (1-4, default 1):
    First sector (2048-41943039, default 2048):
    Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-41943039, default 41943039): +10G
    
    Created a new partition 1 of type 'Linux' and of size 10 GiB.
    
    Command (m for help): w
    The partition table has been altered.
    Calling ioctl() to re-read partition table.
    Syncing disks.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26

    二、创建pv

    [root@cdn ~]# pvcreate /dev/sdb1
      Physical volume "/dev/sdb1" successfully created.
    
    • 1
    • 2

    三、将原vg扩容

    [root@localhost ~]# vgextend bigcloud-enterprise-linux-for-euler /dev/sda4
      Volume group "bigcloud-enterprise-linux-for-euler" successfully extended
    
    • 1
    • 2

    四、扩容pv

    [root@localhost ~]# lvextend -L 60G /dev/bigcloud-enterprise-linux-for-euler/root
      Size of logical volume bigcloud-enterprise-linux-for-euler/root changed from 20.91 GiB (5353 extents) to 60.00 GiB (15360 
    
    extents).
      Logical volume bigcloud-enterprise-linux-for-euler/root successfully resized.
    
    • 1
    • 2
    • 3
    • 4
    • 5

    五、格式化

    [root@localhost ~]# resize2fs /dev/mapper/bigcloud--enterprise--linux--for--euler-root
    resize2fs 1.45.6 (20-Mar-2020)
    Filesystem at /dev/mapper/openeuler-root is mounted on /; on-line resizing required
    old_desc_blocks = 3, new_desc_blocks = 8
    The filesystem on /dev/mapper/bigcloud--enterprise--linux--for--euler-root is now 15728640 (4k) blocks long.
    #使用xfs_growfs命令扩展xfs文件系统,如果是ext4文件系统,则使用resize2fs  /dev/mysql/lv_data 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    六、检查

    [root@localhost ~]# lsblk
    
    • 1
  • 相关阅读:
    spring-data-mongodb的Aggregation详解
    ROS中结合C++语言实现HelloWorld
    大数据之湖仓一体,未来如何发展
    搜索与图论:深度优先搜索
    ffmpeg花屏解决(修改源码,丢弃不完整帧)
    Python3,选择Python自动安装第三方库,从此跟pip说拜拜!!
    8. 控制转义指令
    神经网络 深度神经网络,神经网络进化过程图
    通讯网关软件015——利用CommGate X2MQTT实现MQTT访问Modbus RTU
    【Proteus仿真】8位数码管动态扫描显示变化数据
  • 原文地址:https://blog.csdn.net/weixin_45432833/article/details/134482954