Solution to No space left on device problem when starting openGauss
No space left on device problem solution
Oracle VM VirtualBox 6.1.32 installed openEuler-20.03-LTS-x86_64-dvd, set openEuler to occupy 10G of hard disk virtual space, and then continued to install openGauss2.1.0. During use, the user log and database data gradually increased. The database will be executed later. When the service is started, i.e.: gs_om -t start, problems similar to the following occur.
[omm@db1 ~]$ gs_om -t start
[GAUSS-50205] : Failed to write log file /var/log/gaussdb/omm/om/gs_om-2022-02-08_101000.log. Error:
[Errno 28] No space left on device
1. Failure analysis
According to the error message "No space left on device", you can use df -i to display the inode information.
[omm@db1 ~]#exit
[root@db1 ~]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
devtmpfs 185584 382 185202 1% /dev
tmpfs 189124 1 189123 1% /dev/shm
tmpfs 189124 610 188514 1% /run
tmpfs 189124 17 189107 1% /sys/fs/cgroup
/dev/sda3 524288 118186 406102 23% /
tmpfs 189124 10 189114 1% /tmp
/dev/sda1 65536 343 65193 1% /boot
tmpfs 189124 5 189119 1% /run/user/0
I found that it doesn’t take up much space, the most is
/dev/sda3 524288 118186 406102 23% /
It is not full. Too many small files need to be deleted and further inquiries are required.
ps:在df -h 和df -i 显示使用率。
df -h 是去删除比较大无用的文件———–大文件占用大量的磁盘容量。
df -i 则去删除数量过多的小文件———–过多的文件占用了大量的inode号。
Use the following script to check which directory has the most files.
[root@db1 ~]# for i in / * /; do echo $i; find $i | wc -l; done
/
203858
anaconda-ks.cfg
1
gauss_om
1203
postgresql.conf
1
/
204537
2. Solution
Combined with the previous error message
[GAUSS-50205] : Failed to write log file /var/log/gaussdb/omm/om/gs_om-2022-02-08_101000.log. Error:
[Errno 28] No space left on device
It means that the log file may take up too much space. In this case, use Xftp to check the log file under the /var/log/gaussdb/ directory, as shown in Figure 1. Continue to enter /var/log/gaussdb/omm/pg_audit/dn_6001. After selecting the log files exceeding 1M, delete the logs with earlier dates directly.
After restarting the virtual machine, start the database service.
[omm@db1 ~]$ gs_om -t start
Starting cluster.
=========================================
[SUCCESS] db1
。。。。。
=========================================
Successfully started.
The startup is successful, indicating that the log occupies a large space, causing
[Errno 28] No space left on device
Continue to check the virtual disk status
[omm@db1 ~]$ exit
logout
[root@db1 ~]# fdisk -l /dev/sda
Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x986401e8
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 2099199 2097152 1G 83 Linux
/dev/sda2 2099200 4196351 2097152 1G 82 Linux swap / Solaris
/dev/sda3 4196352 20971519 16775168 8G 83 Linux
3. Further adjustments to increase the space of the virtual machine
In order to completely solve the problem of openEuler virtual machine space, you can use the following methods to expand the space:
Execute in the installation directory D:\Program Files\Oracle\VirtualBox of Oracle VM VirtualBox:
D:\Program Files\Oracle\VirtualBox>VBoxManage list hdds
UUID: 31836802-98ad-4261-abb2-a0dee41c747f
Parent UUID: base
State: created
Type: normal (base)
Location: D:\Program Files\VMwork\openEuGau2.1\openEuler.vdi
Storage format: VDI
Capacity: 10240 MBytes
Encryption: disabled
The disk and path information of all virtual machines is listed above. Find the virtual machine you need to adjust the space and note the UUID
. value, for example: 31836802-98ad-4261-abb2-a0dee41c747f . The virtual machine openEuler installed above is D:\Program Files\VMwork\openEuGau2.1\openEuler.vdi, which occupies 10240 Mbytes (10G) space.
(1), Adjust and increase virtual machine space under Windows
Execute in the installation directory of Oracle VM VirtualBox:
D:\Program Files\Oracle\VirtualBox>vBoxManage modifyhd 31836802-98ad-4261-abb2-a0dee41c747f --resize 15240
Description: –resize 15240 Unit: M
After execution is completed, the display is as follows:
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
(2) The virtual machine space under Windows has been updated
Execute VBoxManage list hdds again to view, you will find that the virtual machine space has been updated, and the allocated virtual space is 15240 MBytes.
D:\Program Files\Oracle\VirtualBox>VBoxManage list hdds
UUID: 31836802-98ad-4261-abb2-a0dee41c747f
Parent UUID: base
State: created
Type: normal (base)
Location: D:\Program Files\VMwork\openEuGau2.1\openEuler.vdi
Storage format: VDI
Capacity: 15240 MBytes
Encryption: disabled
(3) Check the virtual machine storage space in the virtual machine
Check the storage settings of the virtual machine and see that the original storage space has been modified from 10GB to 14.88GB, indicating that the modification was successful.