/dev/mapper/pve-root used 51%.

sshami

New Member
Mar 14, 2021
17
0
1
35
Hello Support out there,
I have standalone Proxmox server where i am noticing space is almost 51% used.

Code:
Filesystem            Size  Used Avail Use% Mounted on
udev                   63G     0   63G   0% /dev
tmpfs                  13G  154M   13G   2% /run
/dev/mapper/pve-root  104G   50G   49G  51% /
tmpfs                  63G   43M   63G   1% /dev/shm
tmpfs                 5.0M     0  5.0M   0% /run/lock
tmpfs                  63G     0   63G   0% /sys/fs/cgroup
/dev/sdc2             511M  312K  511M   1% /boot/efi
/dev/fuse              30M   32K   30M   1% /etc/pve
tmpfs                  13G     0   13G   0% /run/user/1000
total                 318G   50G  263G  16% -

Basically this the root (/dev/mapper/pve-root) where os installed.

How to cleanup to see where all the spaces used.
 
hi,

How to cleanup to see where all the spaces used.
you can check like this:
Code:
 du -a / 2>/dev/null | sort -n -r | head -n 30

change the number at head if you want to see more.
 
Thanks!

As i can see location
/var/log

4905608468 Jan 25 10:45 lastlog

Is it okay to clear lastlog and how to clear.

This is the result.

Code:
50790881    /
25079312    /home
25079024    /home/vzdump-qemu-121-2021_10_02-23_02_33.vma.zst
22294356    /var
22133248    /var/lib
21974824    /var/lib/vz
15119904    /var/lib/vz/dump
15119852    /var/lib/vz/dump/vzdump-qemu-117-2021_07_14-15_30_50.vma
6854912    /var/lib/vz/template
6854900    /var/lib/vz/template/iso
3260520    /usr
1728748    /usr/lib
827880    /usr/share
553420    /usr/lib/modules
542348    /usr/bin
364204    /usr/lib/firmware
338308    /usr/lib/x86_64-linux-gnu
277228    /usr/lib/modules/5.4.106-1-pve
276188    /usr/lib/modules/5.4.73-1-pve
265416    /usr/lib/modules/5.4.106-1-pve/kernel
265276    /usr/lib/modules/5.4.73-1-pve/kernel
220692    /usr/share/kvm
193316    /usr/lib/modules/5.4.106-1-pve/kernel/drivers
193244    /usr/lib/modules/5.4.73-1-pve/kernel/drivers
 
Is it okay to clear lastlog and how to clear.
you could also just compress it and delete the old one (should compress pretty well with something like: tar czvf /var/log/lastlog.tar.gz /var/log/lastlog and then you can delete the old one (will be recreated)

otherwise you still seem to have about 50G of space so i wouldn't worry too much. that's only for the root partition. you probably also have other disks?
if not then maybe you should :D
 
Hi Oguz, Thanks for the info!
After compressing lastlog file then delete, then there is no auto created lastlog file. If its deleted won't be any problem ?

I have created a script for disk cleanup, would like to hear your input or any ideas will be highly appreciated.


Code:
#!/bin/sh

#set -e

printf "Disk information\n"
df /dev/mapper/pve-root -h

#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives


#Systemd journal logs
journalctl --disk-usage
journalctl --rotate --vacuum-size=50M
journalctl --vacuum-time=20d


#Remove old log files
rm -f /var/log/*gz


#lastlog file (this file is bigger in size)
tar czvf /var/log/lastlog.tar.gz
rm -rf /var/log/lastlog



printf "Disk information\n"
df /dev/mapper/pve-root -h


#Cleaning is completed
echo "Proxmox Diskcleanup Sript successfully executed!"
 
Hi Oguz, Thanks for the info!
After compressing lastlog file then delete, then there is no auto created lastlog file. If its deleted won't be any problem ?

I have created a script for disk cleanup, would like to hear your input or any ideas will be highly appreciated.


Code:
#!/bin/sh

#set -e

printf "Disk information\n"
df /dev/mapper/pve-root -h

#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives


#Systemd journal logs
journalctl --disk-usage
journalctl --rotate --vacuum-size=50M
journalctl --vacuum-time=20d


#Remove old log files
rm -f /var/log/*gz


#lastlog file (this file is bigger in size)
tar czvf /var/log/lastlog.tar.gz
rm -rf /var/log/lastlog



printf "Disk information\n"
df /dev/mapper/pve-root -h


#Cleaning is completed
echo "Proxmox Diskcleanup Sript successfully executed!"
you're missing the argument in the tar line, should be rather like: tar czvf /var/log/lastlog.tar.gz /var/log/lastlog

you could also add the current date into the name of the created archive file so you don't confuse it :)