Starting today, I would like to cover Linux here at Winaero! There's no need to panic. It will not replace our regular Windows articles and we will not shift the focus from Windows to Linux manuals and tutorials. However, it will be a nice addition for everyone who wants to give Linux a try for the first time if they are not satisfied with Windows. We will show on our blog how to prepare your PC to install Linux in a dual boot configuration. Today's article is about how to partition the disk drive and optionally make it use a single partition. If you plan to switch to Linux in the future, or if you are just curious about this operating system, you will enjoy it.
Although I prefer Arch Linux for daily use, and it is my primary operating system, here we will cover Linux Mint because it is easy to use and is perfect for anyone familiar with Microsoft Windows. Linux Mint is one of the most popular distros at the moment of this writing. It combines the benefits of the popular Ubuntu Linux with the classic Desktop usability of Windows.
These days, more and more users are interested in trying out some alternative OS besides Windows. The latest Windows versions have become unsatisfactory even for people who were in the Windows camp for many years.
Today, Linux has made huge strides in end user usability and aesthetics. Previously, it was a bit geeky and installation wasn't that simple. You were given too many choices and still had to resort to the command line for some operation. Modern Linux distros have a simple graphical installer which makes installation a breeze. It is as easy as installing Windows.
How to partition your hard drive for Linux Mint
It is a myth that Linux requires many partitions on the hard drive. Actually, there is no reason to have lots of partitions. When installing, you can omit most of them and have only a single partition where your Linux distribution will be installed.
Personally, I prefer having the following partition layout:
/boot - 300MB
/ - root partition of 20 GB
/home - the largest partition.
/swap - 2 x size of RAM
The boot partition has the boot loader files. The root partition contains the operating system files, logs and configuration files. The swap partition is used when your system needs to move memory pages between the RAM and the disk. And the Home partition contains all the user data, that is why it has the largest size.
But there is no actual reason to have a separate /boot partition unless you have some exotic or encrypted file system for the root (/) partition which cannot be read by the Linux kernel directly.
The reason I made a separate /home partition is for data safety. That way, you can unmount the /home partition and perform system maintenance without risk of data loss. You can even reinstall the operating system and format all the other partitions and keep your /home partition with all your data and app preferences intact!
As I said above, you can omit all these separate partitions and you can have only the /root partition. As for the swap partition, you can instead have a swap file. A swap file is slightly slower than a dedicated partition but is still quite usable. If you worry about slowdown issues, then just create the swap partition 2 x the size of your RAM.
To create the desired partition layout when installing Linux Mint, switch the installer's page to "something else":
It will show you the partitions on your hard drive. Mine has no partitions:
The swap file
If you decided to not create a swap partition and use the swap file instead, you need to do the following steps after the installation:
- Open the terminal app.
- Type the following:
- Type the following in the terminal:
# fallocate -l 1024M /swapfile
This will create a new file, /swapfile with 1 GB of size. Adjust the size to the desired value.
- Adjust permissions for the /swapfile file using the following command:
# chmod 600 /swapfile
- Format the file to be used as a swap file:
# mkswap /swapfile
- You just created a ready-to-use swap file. Now you need to make it active. Open the /etc/fstab file with any text editor. Nano text editor is pretty good for this task:
# nano /etc/fstab
- Type the following line in Nano:
/swapfile none swap defaults 0 0
- Press Ctrl + O to save the /etc/fstab file.
- Press Ctrl + X to exit Nano.
You are done. After rebooting, the operating system will use the file /swapfile as the swap file. To check how your operating system is using the swap partition or the swap file, type the following command in the terminal:
$ cat /proc/swaps
That's it. So, it is possible to use only one partition to run the Linux Mint operating system smoothly.