How Much Disk Space For Ubuntu
If you ever had plan out the installation of an Ubuntu Linux system you probably found yourself asking “How much disk space for Ubuntu?”. According to their website Ubuntu recommends 25GB of storage for the desktop edition. You can definitely do with less but there is a good chance you will need more. It all depends on your use case.
Short Answer: “It depends”
There are a lot of things to consider and we’re going to go over these along with some example scenarios but first we’re going to actually test out a fresh installation and see what the requirements really are. We got it down to 2.4 GB with a little work.
Testing: How Much Disk Space For Ubuntu
We used two freshly installed test systems in VirtualBox. We didn’t install any optional software so your mileage may vary depending on what choices you make.
- Ubuntu 19.10 Server ( no extras selected ) - 6.3 GB used after initial install, 2.4 GB after removing the swap file
- Ubuntu 19.10 Desktop ( normal install ) - 7.8 GB used after initial install, 6.2 GB after removing the swap file
So take the values above as the absolute minimum for the OS and add whatever space you think you might need to for files.
If you remove the swap file you can actually get lower though. We got the server down to 2.4 GB and the desktop down to 6.2 GB. See the section further below on swap files.
It is important to note that a given installation might use a different amount of disk space based on what options you choose. The desktop installer lets you select either a normal install or minimal install. With a minimal install you might save some more space. The Ubuntu server installation has a large number of optional server components that can be selected such as Kubernetes. These could end up using quite a bit more disk space.
Keep in mind that there is a good chance you will want to add more software after installation. Also, this is in addition to whatever data you might want to store.
Here is a screenshot from a freshly installed Ubuntu 19.10 desktop VM:
Another screen shot showing the disk tool:
Here is a screenshot from a freshly installed Ubuntu 19.10 server VM:
A Note on Swap Space
Our Ubuntu 19.10 desktop install created a 2 GB swap file while the our Ubuntu 19.10 server created a 3.9 GB swap file. No swap partitions were created.
Here is what it looks like on the server:
Here is what it looks like on the desktop:
You can actually disable and remove swap space if you like. We were able to cut the server disk useage down to 2.4 GB and the desktop down to 6.2 GB.
This is what we tested on the server:
sudo swapoff -a -v # disable all swap
sudo rm /swap.img # remove swap file
sudo vi /etc/fstab # remove swap entry
This is what we tested on the desktop:
sudo swapoff -a -v # disable all swap
sudo rm /swapfile # remove swap file
sudo vi /etc/fstab # remove swap entry
How much space should i allocate for Ubuntu?
There are several different things to take into account.
- Operating system
- Software / Applications
- Application data ( database, webpages, etc. )
- Logs
You might actually want to use separate disks for data and for your operating system. This way it is easier to expand your system later. Another advantage is that if you ever need to rebuild your machine or reinstall the OS, it doesn’t pose as much of a risk to your data. You can even disconnect your data disks while reinstalling the OS.
It is very common to use a separate disk or partition for /var since this is where logs are written. The advantage of this is that if logs accidentally fill up your file system they won’t effect your root disk.
Server Example
As an example, you might have something like this. Note that /data is on a separate drive and the others are all on the same drive.
/boot | sda1 | 100 MB | Just the boot partition |
swap | sda2 | 16 GB | Swap space |
/ | sda3 | 10 GB | Holds the OS and bundled software |
/var | sda4 | 38 GB | Holds logs which should be rotated on a schedule |
/data | sdb1 | 500 GB | Holds application data |
Tiny Laptop Example
If you were running a really tiny laptop with a really tiny disk you might have something a little more like this. It would give you only a little bit of extra space after installing your OS. Your logs would just be written to your root disk. This could be totally acceptable if you either don’t have a lot of data or just rely on cloud storage.
/boot | sda1 | 100 MB | Just the boot partition |
swap | sda2 | 1 GB | Swap space |
/ | sda3 | 15 GB | Holds the OS and bundled software |
References