---
# System prepended metadata

title: VM Storage Full Troubleshoot

---

Currently, we have 4 VM (Virtual Machine) that used for building kubernetes cluster and also for testing applications. 

There are detail about our VM use until now : 
1. Node1 (rafli) 10.30.1.212
2. Node2 (rafli) 10.30.1.213
3. Node3 (ari) 10.30.1.214
4. Node4 (bagus) 10.30.1.221
 
Recently there has been a problem with storage where the storage is being fully used.

Here are the solutions to fix the problems:

**1. Check subdirectory storage used**
We can check how many storage used for every subdirectories by used this command below : 
```
sudo du -sh *
```
![image](https://hackmd.io/_uploads/S1eVAkmIqa.png)
Also use grep to filter the output that we need, in the image i used G for filtering Gigabyte size storage use only

**2. Configure and delete syslog**
Syslog take too much storage in VM, we can flush/erase the log with the command:
```
# > /var/log/syslog
```
Configure the syslog that is to use only 1 GB storage
```
$ sudo nano /etc/logrotate.d/rsyslog

/var/log/syslog
/var/log/mail.info
/var/log/mail.warn
/var/log/mail.err
/var/log/mail.log
/var/log/daemon.log
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
/var/log/lpr.log
/var/log/cron.log
/var/log/debug
/var/log/messages
{
        rotate 4
        weekly
        maxsize 1G #add this line
        missingok
        notifempty
        compress
        delaycompress
        sharedscripts
        postrotate
                /usr/lib/rsyslog/rsyslog-rotate
        endscript
}
```
Restart the syslog with systemctl
```
$ sudo systemctl restart syslog
```
Also delete the syslog cache that is used .[number] or .gz in the file
```
$ sudo rm syslog.1
$ sudo rm syslog.2.gz
$ sudo rm syslog.3.gz
$ sudo rm syslog.4.gz
```


**3. Resize the journalctl size**
Journactl used big storage to save log. Use this command to limit the storage will be used for journalctl.
```
$ sudo journalctl --vacuum-size=100M
```

**4. Delete linux modules**
Linux only use 1 module to running the VM. There are many module installed in linux but not use by linux.

Check the module used by linux
```
$ uname -r
```
Next, check modules installed in linux
```
$ dpkg-query --show 'linux-modules-*'
```
Last, delete the modules that is not used in linux
```
$ sudo apt remove $(dpkg-query --show 'linux-modules-*' | cut -f1 | grep -v "$(uname -r)") --purge
```
