首页 > 系统相关 >centos扩展磁盘

centos扩展磁盘

时间:2022-11-17 10:04:43浏览次数:62  
标签:centos 扩展 64M dev var 磁盘 root shm

1. centos 扩展磁盘分区

  • 1.1 系统环境
    • vmware
    • centos 7.9

2.扩展步骤

2.1 步骤一

关机状态下在设置->硬盘->扩展->选择硬盘大小; 我这里选择扩展到50G

2.2 步骤二

  • 进入系统内部执行命令扩展磁盘大小,主要是创建逻辑卷(PVC)/物理卷(PV),从逻辑卷(LV)映射到物理卷(PV):
    df -mh   
    fdisk -l
    pvcreate /dev/sda3
    vgextend centos  /dev/sda3
    vgs
    pvdisplay
    lvextend -L +29.9G /dev/mapper/centos-root
    xfs_growfs /dev/mapper/centos-root
    df -mh
    

2.2.1 执行扩展示例

root@localhost ~ # df -mh
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 969M     0  969M   0% /dev
tmpfs                    980M     0  980M   0% /dev/shm
tmpfs                    980M  9.9M  970M   2% /run
tmpfs                    980M     0  980M   0% /sys/fs/cgroup
/dev/mapper/centos-root   17G   14G  3.3G  81% /
/dev/sda1               1014M  299M  716M  30% /boot
overlay                   17G   14G  3.3G  81% /var/lib/docker/overlay2/0971f73c015ca770356f4ba4b30afeaf8a5bab897787d00fb12e976013c816b4/merged
overlay                   17G   14G  3.3G  81% /var/lib/docker/overlay2/080f5771c97382cba9de40fc04cc449d661831cb6404d1165ba5f9d94ff097a4/merged
overlay                   17G   14G  3.3G  81% /var/lib/docker/overlay2/418d6d02082ce2c868843e06cf9bbcefc8d854620a779e5d40c9e818ddc9ff8b/merged
overlay                   17G   14G  3.3G  81% /var/lib/docker/overlay2/1a3310ec1ffe14dc972c46ecc56cae627c66ac6ea22d8ec86a7ee341ab395a3a/merged
shm                       64M     0   64M   0% /var/lib/docker/containers/89721e8e469f187ee631632a86e158c752ae93b901bdc968567231797e24d6f0/mounts/shm
shm                       64M     0   64M   0% /var/lib/docker/containers/65e865a368434ff6d6ead1bd3eae5566dc3c75eeb8b747ec6bebc046a6d94d14/mounts/shm
shm                       64M     0   64M   0% /var/lib/docker/containers/2be6579cd347c2b993e85cd17289dc6205aeb0fa2e566e99893b31c66fc6ea37/mounts/shm
shm                       64M   16K   64M   1% /var/lib/docker/containers/039aef669459f804f306b710b845c090efcad0a0359cc9aa3428580dc0117b2b/mounts/shm
tmpfs                    196M     0  196M   0% /run/user/0


root@localhost ~ # fdisk -l

root@localhost ~ # pvcreate /dev/sda3
  Physical volume "/dev/sda3" successfully created.

root@localhost ~ # vgextend centos  /dev/sda3
  Volume group "centos" successfully extended

root@localhost ~ # vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  centos   2   2   0 wz--n- 48.99g <30.00g
root@localhost ~ # vgdisplay
  --- Volume group ---
  VG Name               centos
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               48.99 GiB
  PE Size               4.00 MiB
  Total PE              12542
  Alloc PE / Size       4863 / <19.00 GiB
  Free  PE / Size       7679 / <30.00 GiB
  VG UUID               vFfONo-DxPv-pnCQ-lPtz-3gCe-8dqz-dqFywm

root@localhost ~ # pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               centos
  PV Size               <19.00 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              4863
  Free PE               0
  Allocated PE          4863
  PV UUID               tiJXzP-GDDT-o2Nb-M3sZ-LjpH-mJhD-82rx1B

  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               centos
  PV Size               30.00 GiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              7679
  Free PE               7679
  Allocated PE          0
  PV UUID               0tXB8b-zDVW-f0xz-7zpy-sfhc-A7dh-29te0U

root@localhost ~ # lvextend -L +29.9G /dev/mapper/centos-root
  Rounding size to boundary between physical extents: 29.90 GiB.
  Size of logical volume centos/root changed from <17.00 GiB (4351 extents) to <46.90 GiB (12006 extents).
  Logical volume centos/root successfully resized.

# resize2fs /dev/mapper/centos-root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos-root
Couldn't find valid filesystem superblock.

root@localhost ~ # xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512    agcount=4, agsize=1113856 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=4455424, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 4455424 to 12294144


root@localhost ~ # df -mh
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 969M     0  969M   0% /dev
tmpfs                    980M     0  980M   0% /dev/shm
tmpfs                    980M  9.9M  970M   2% /run
tmpfs                    980M     0  980M   0% /sys/fs/cgroup
/dev/mapper/centos-root   47G   14G   34G  30% /
/dev/sda1               1014M  299M  716M  30% /boot
overlay                   47G   14G   34G  30% /var/lib/docker/overlay2/0971f73c015ca770356f4ba4b30afeaf8a5bab897787d00fb12e976013c816b4/merged
overlay                   47G   14G   34G  30% /var/lib/docker/overlay2/080f5771c97382cba9de40fc04cc449d661831cb6404d1165ba5f9d94ff097a4/merged
overlay                   47G   14G   34G  30% /var/lib/docker/overlay2/418d6d02082ce2c868843e06cf9bbcefc8d854620a779e5d40c9e818ddc9ff8b/merged
overlay                   47G   14G   34G  30% /var/lib/docker/overlay2/1a3310ec1ffe14dc972c46ecc56cae627c66ac6ea22d8ec86a7ee341ab395a3a/merged
shm                       64M     0   64M   0% /var/lib/docker/containers/89721e8e469f187ee631632a86e158c752ae93b901bdc968567231797e24d6f0/mounts/shm
shm                       64M     0   64M   0% /var/lib/docker/containers/65e865a368434ff6d6ead1bd3eae5566dc3c75eeb8b747ec6bebc046a6d94d14/mounts/shm
shm                       64M     0   64M   0% /var/lib/docker/containers/2be6579cd347c2b993e85cd17289dc6205aeb0fa2e566e99893b31c66fc6ea37/mounts/shm
shm                       64M   16K   64M   1% /var/lib/docker/containers/039aef669459f804f306b710b845c090efcad0a0359cc9aa3428580dc0117b2b/mounts/shm
tmpfs                    196M     0  196M   0% /run/user/0

3.参考:

标签:centos,扩展,64M,dev,var,磁盘,root,shm
From: https://www.cnblogs.com/kelley-h/p/16898421.html

相关文章

  • CentOS 7 开启 iptables
    1、关闭CentOS7自带的 firewall防火墙#关闭防火墙systemctlstopfirewalld#取消开机启动systemctldisablefirewalld2、安装 iptables-services#Cetnos7默认已......
  • CentOS 7 安装 vsftpd
    1、安装 yum-yinstallvsftpdvi/etc/vsftpd/vsftpd.confuserlist_enable=NO#YES改为NO2、添加防火墙端口vi/etc/sysconfig/iptables-AINPUT-ptcp-mstate--stat......
  • CentOS 6.8 安装 Samba 服务器
    1、开启防火墙-AINPUT-mstate--stateNEW-mtcp-ptcp--dport139-jACCEPT-AINPUT-mstate--stateNEW-mtcp-ptcp--dport445-jACCEPT2、关闭SELINUX#临......
  • CentOS 6.8 网络设置(有线)
    cd/etc/sysconfig/network-scripts/#切换到网络配置目录viifcfg-eth0#打开网卡配置文件DEVICE=eth0HWADDR=08:00:27:92:3C:1FTYPE=EthernetUUID=09848d3a-fff2-4b9b-a9d......
  • CentOS 如何更新 yum 源
    1、进入目录:cd/etc/yum.repos.d2、备份文件:mvCentOS-Base.repoCentOS-Base.repo.backup3、Centos6.8更新网易源 #Centos更新网易源curl-Ohttp://mirrors.163.co......
  • CentOS 卸载 K8S
    1、删除 k8s 组件kubeadmreset-f2、删除其它容器和所有镜像dockerkill$(dockerps-a-q)dockerrm$(dockerps-a-q)dockerrmi-f$(dockerimages-q)3、清除ip......
  • 时刻追逐常新前沿技术 VWmare ESXI 8里安装centos stream 9
    时刻追逐常新前沿技术VWmareESXI8里安装centosstream9在2022年底、大家都还在使用VWmareESXI6.5、centos7时,我就想大胆的尝试一下VWmareESXI8再到最新的ESXI......
  • MAUI新生1.3-XAML语法基础:标记扩展原理
    标记扩展,本质上是IMarkupExtension或者IMarkupExtension<T>接口的实现类。这两个接口,均定义了ProvideValue方法。注意,IMarkupExtension<T>继承自IMarkupExtension,如果定义......
  • Centos 7 安装 docker-compose
    1、下载curl-Lhttps://github.com/docker/compose/releases\/download/1.21.2/docker-compose-`uname-s`-`uname-m`-o/usr/local/bin/docker-compose可能上面的下载比......
  • CentOS 7 安装 Ansible
    ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet、cfengine、chef、func、fabric)的优点,实现了批量系统配置、批量程序部署、批量运行命令等功能。......