问题描述:在下载python包时,报错:
ERROR: Could not install packages due to an EnvironmentError: [Errno 28] No space left on device
问题排查: 发现/dev/mapper/cl-root文件系统占用已达到100%
[elasticsearch@localhost ~]$ df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.4G 0 1.4G 0% /dev tmpfs 1.4G 4.0K 1.4G 1% /dev/shm tmpfs 1.4G 8.5M 1.4G 1% /run tmpfs 1.4G 0 1.4G 0% /sys/fs/cgroup /dev/mapper/cl-root 16G 16G 147M 100% / /dev/sda2 976M 133M 777M 15% /boot /dev/sda1 599M 6.8M 593M 2% /boot/efi tmpfs 278M 0 278M 0% /run/user/1001 tmpfs 278M 0 278M 0% /run/user/1002
其他方法,来源于网络:
- 彻底清除 rm 命令残留的文件 【尝试后,发现并不适合,从100%变成了99%,应该是我本来残留的文件就不大】将其他文件系统的容量分配给root文件系统一些【我并没有用,我的理解是,其他的也不多】
最终我决定进行扩容,我的虚拟机是用Hyper-V进行管理的。
关闭虚拟机,设置虚拟机,磁盘管理,扩容50G
[elasticsearch@localhost ~]$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 100G 0 disk ├─sda1 8:1 0 600M 0 part /boot/efi ├─sda2 8:2 0 1G 0 part /boot ├─sda3 8:3 0 18.4G 0 part │ ├─cl-root 253:0 0 46.4G 0 lvm / │ └─cl-swap 253:1 0 2G 0 lvm [SWAP] └─sda4 8:4 0 30G 0 part └─cl-root 253:0 0 46.4G 0 lvm / sr0 11:0 1 7G 0 rom [elasticsearch@localhost ~]$ fdisk /dev/sda
看到,sda已经100G了,后来我对其进行了一次30G扩容。决定在进行10G扩容
创建分区:忘了写 + 号,报错两次,哈哈哈
[root@localhost ~]# fdisk /dev/sda Welcome to fdisk (util-linux 2.32.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): n Partition number (5-128, default 5): First sector (104855552-209715166, default 104855552): Last sector, +sectors or +size{K,M,G,T,P} (104855552-209715166, default 209715166): 10G Value out of range. Last sector, +sectors or +size{K,M,G,T,P} (104855552-209715166, default 209715166): 5G Value out of range. Last sector, +sectors or +size{K,M,G,T,P} (104855552-209715166, default 209715166): +10G Created a new partition 5 of type 'Linux filesystem' and of size 10 GiB. Command (m for help): w The partition table has been altered. Syncing disks.
查看分区:已创建 sda5
[root@localhost ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 100G 0 disk ├─sda1 8:1 0 600M 0 part /boot/efi ├─sda2 8:2 0 1G 0 part /boot ├─sda3 8:3 0 18.4G 0 part │ ├─cl-root 253:0 0 46.4G 0 lvm / │ └─cl-swap 253:1 0 2G 0 lvm [SWAP] ├─sda4 8:4 0 30G 0 part │ └─cl-root 253:0 0 46.4G 0 lvm / └─sda5 8:5 0 10G 0 part sr0 11:0 1 7G 0 rom
扩容:创建物理卷
[root@localhost ~]# lvm lvm> pvcreate /dev/sda5 Physical volume "/dev/sda5" successfully created. lvm> pvdisplay --- Physical volume --- PV Name /dev/sda3 VG Name cl PV Size 18.41 GiB / not usable 2.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 4713 Free PE 0 Allocated PE 4713 PV UUID L5rZ2u-wT9S-TMBL-1b48-2cPp-dgUs-19ZdzX --- Physical volume --- PV Name /dev/sda4 VG Name cl PV Size 30.00 GiB / not usable 4.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 7679 Free PE 0 Allocated PE 7679 PV UUID j4bUmo-lAgX-RwBP-ID0h-DlkZ-xoR1-TdSxpM "/dev/sda5" is a new physical volume of "10.00 GiB" --- NEW Physical volume --- PV Name /dev/sda5 VG Name PV Size 10.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID weC1Mt-2sZM-XUGV-tRRk-hwv2-ffck-ByphVV
将物理卷加入到卷组
lvm> vgextend cl /dev/sda5 Volume group "cl" successfully extended lvm> vgdisplay --- Volume group --- VG Name cl System ID Format lvm2 metadata Areas 3 metadata Sequence No 6 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 3 Act PV 3 VG Size 58.40 GiB PE Size 4.00 MiB Total PE 14951 Alloc PE / Size 12392 / <48.41 GiB Free PE / Size 2559 / <10.00 GiB VG UUID 1KixID-ckoX-S7L6-nEe0-pILr-G7Lj-jltxxb lvm> lvextend -l +100%FREE /dev/cl/root Size of logical volume cl/root changed from <46.41 GiB (11880 extents) to 56.40 GiB (14439 extents). Logical volume cl/root successfully resized. lvm> exit Exiting.
同步到文件系统, 对 / 目录进行扩容
[root@localhost ~]# xfs_growfs / meta-data=/dev/mapper/cl-root isize=512 agcount=12, agsize=1075456 blks = sectsz=4096 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=1 data = bsize=4096 blocks=12165120, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =internal log bsize=4096 blocks=2560, version=2 = sectsz=4096 sunit=1 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 12165120 to 14785536
查看结果: df -h
[root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.4G 0 1.4G 0% /dev tmpfs 1.4G 4.0K 1.4G 1% /dev/shm tmpfs 1.4G 8.5M 1.4G 1% /run tmpfs 1.4G 0 1.4G 0% /sys/fs/cgroup /dev/mapper/cl-root 57G 16G 41G 28% / /dev/sda2 976M 133M 777M 15% /boot /dev/sda1 599M 6.8M 593M 2% /boot/efi tmpfs 278M 0 278M 0% /run/user/1001 tmpfs 278M 0 278M 0% /run/user/1002 tmpfs 278M 0 278M 0% /run/user/0
约为16G + 30G + 10G = 56G 约等于 57G
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)