Answers
Got a burning question about open source or the kernel? Whatever your level, email it to answers@linuxformat.com
Neil Bothwick lives in a Tux shaped house powered by Linux, honest!
Q Virtually full disk
I have a fairly old version of Linux Mint Xfce installed in a VirtualBox virtual machine. The size of the virtual disk is roughly 20GB and now 18GB has been taken up. How can I find big packages so I can see whether they have been used, and remove them as needed?
Cameron Wright
A Are you running out of space on the virtual disk or on the physical disk holding it? VirtualBox creates dynamically sized virtual disks by default. This means that if you create a 20GB disk and load 10GB of data on to it, the virtual disk file is only about 10GB in size. As you add to it, the file grows, but bear in mind that if you remove data from the virtual disk, the file does not shrink. So, a size of 18GB only means it has held that much data at some time. If you delete, say, 5GB, the file is still 18GB even though it only holds 13GB. That space is not lost, though, as it is used as you add further data. So, the first step is to check how much is actually in use by running $ df -h / in a terminal within the virtual machine.
BleachBit (
www.bleachbit.org) is a good way to identify and remove cruft from your hard drive.
If it is significantly less than the 18GB taken up by the disk file, you can resize the virtual disk file to reclaim the unused space, but it will subsequently grow as you write to the virtual disk. On the opposite side of the equation, if the virtual disk is nearly full but you have plenty of space on the host system, you can enlarge the virtual disk in the Virtual Media Manager section of VirtualBox. Do this while the VM is not running. When you start it up, the extra space is not available to you until you open the partition manager or GParted and resize the root partition.
If you need to reclaim space within the virtual machine, you should first look at cache directories, especially .cache in your home directory and /var/cache/apt/ archives. The latter contains package files downloaded by the package manager. These can be safely deleted. Once you have cleared out old files, turn your attention to installed packages and get a size-ordered listing using Aptitude. This may not be installed, but you can install it from the package manager and it does not need much space. It is a standard tool for package manipulation on Debian-based systems. Then open a terminal and run this command: