How remove old PVE Images

informant

Renowned Member
Jan 31, 2012
780
10
83
Hi all, how can i remove old PVE images:

Code:
Found linux image: /boot/vmlinuz-2.6.32-25-pve
Found initrd image: /boot/initrd.img-2.6.32-25-pve
Found linux image: /boot/vmlinuz-2.6.32-24-pve
Found initrd image: /boot/initrd.img-2.6.32-24-pve
Found linux image: /boot/vmlinuz-2.6.32-23-pve
Found initrd image: /boot/initrd.img-2.6.32-23-pve
Found linux image: /boot/vmlinuz-2.6.32-22-pve
Found initrd image: /boot/initrd.img-2.6.32-22-pve
Found linux image: /boot/vmlinuz-2.6.32-21-pve
Found initrd image: /boot/initrd.img-2.6.32-21-pve
Found linux image: /boot/vmlinuz-2.6.32-20-pve
Found initrd image: /boot/initrd.img-2.6.32-20-pve
Found linux image: /boot/vmlinuz-2.6.32-19-pve
Found initrd image: /boot/initrd.img-2.6.32-19-pve
Found linux image: /boot/vmlinuz-2.6.32-18-pve
Found initrd image: /boot/initrd.img-2.6.32-18-pve
Found linux image: /boot/vmlinuz-2.6.32-17-pve
Found initrd image: /boot/initrd.img-2.6.32-17-pve
Found linux image: /boot/vmlinuz-2.6.32-16-pve
Found initrd image: /boot/initrd.img-2.6.32-16-pve

regards
 
# dpkg -r pve-kernel-2.6.32-16-pve
# dpkg -r pve-kernel-2.6.32-17-pve
# dpkg -r pve-kernel-2.6.32-18-pve
...
 
Biggest Thankls @dietmar.

Can you include a option, to remove automatical old images and only last 3 images aren´t delete?

regards
 
You will have to use Script to achieve that. I dont think there is a single Linux command which will auto delete based on criteria. Below is a sample code that you can start with. Test it before you put it in action:

if [[ $(ls /boot/vmlinuz*.* | wc -l) > 10 ]]then
find /boot/vmlinuz*.* ! -newer $(ls -t | sed '11!d') -exec rm {} \; fi

This example keeps 10 files then deletes older files. You can just switch 10 to 3. But... DO EXPERIMENT FIRST ON TEST FOLDER!!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!