周梦康 发表于 2019-03-18 2188 次浏览 标签 : Linux

发现虚拟机磁盘满了

[root@bogon ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  6.2G  6.2G   51M 100% /
devtmpfs                 908M     0  908M   0% /dev
tmpfs                    920M     0  920M   0% /dev/shm
tmpfs                    920M  8.6M  911M   1% /run
tmpfs                    920M     0  920M   0% /sys/fs/cgroup
/dev/sda1               1014M  175M  840M  18% /boot
tmpfs                    184M     0  184M   0% /run/user/0

首先搜到了这个方案 https://my.oschina.net/u/3754919/blog/1815917
感觉太繁琐了,肯定有不用删除文件的方案。

[root@bogon ~]# ls /dev/sd*
/dev/sda  /dev/sda1  /dev/sda2  /dev/sdb
[root@bogon ~]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  centos   1   2   0 wz--n- <7.00g    0
[root@bogon ~]# pvcreate /dev/sdb
WARNING: ext4 signature detected on /dev/sdb at offset 1080. Wipe it? [y/n]: y
  Wiping ext4 signature on /dev/sdb.
  Physical volume "/dev/sdb" successfully created.
[root@bogon ~]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  centos   1   2   0 wz--n- <7.00g    0
[root@bogon ~]# vgextend centos /dev/sdb
  Volume group "centos" successfully extended
[root@bogon ~]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  centos   2   2   0 wz--n- 26.99g <20.00g
[root@bogon ~]# lvs
  LV   VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root centos -wi-ao----  <6.20g
  swap centos -wi-ao---- 820.00m
[root@bogon ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  6.2G  6.2G   43M 100% /
devtmpfs                 908M     0  908M   0% /dev
tmpfs                    920M     0  920M   0% /dev/shm
tmpfs                    920M  8.6M  911M   1% /run
tmpfs                    920M     0  920M   0% /sys/fs/cgroup
/dev/sda1               1014M  175M  840M  18% /boot
tmpfs                    184M     0  184M   0% /run/user/0
[root@bogon ~]# lvextend -L +20G /dev/mapper/centos-root
  Insufficient free space: 5120 extents needed, but only 5119 available
[root@bogon ~]# lvextend -L +10G /dev/mapper/centos-root
  Size of logical volume centos/root changed from <6.20 GiB (1586 extents) to <16.20 GiB (4146 extents).
  Logical volume centos/root successfully resized.
[root@bogon ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512    agcount=4, agsize=406016 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=1624064, 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 1624064 to 4245504
[root@bogon ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   17G  6.2G   11G  39% /
devtmpfs                 908M     0  908M   0% /dev
tmpfs                    920M     0  920M   0% /dev/shm
tmpfs                    920M  8.6M  911M   1% /run
tmpfs                    920M     0  920M   0% /sys/fs/cgroup
/dev/sda1               1014M  175M  840M  18% /boot
tmpfs                    184M     0  184M   0% /run/user/0

https://www.cnblogs.com/feiyun126/p/7680534.html
https://blog.csdn.net/dream_yunhoo/article/details/19650417

评论列表