Answer the question
In order to leave comments, you need to log in
How to properly partition a disk for Linux?
Hello! I have about 150 GB of free hard disk space. Please tell me how to partition the disk, how much space to allocate for /, / home and swap. And can you explain why you need to make a separate partition for / home.
Answer the question
In order to leave comments, you need to log in
About /home was written above. You can imagine that this is the D: / drive in windows that does not need to be formatted when reinstalling the system.
For swap, you don’t need to make a separate partition, you can create it as a file, again, almost like in windows.
It is advisable to make a separate /boot partition. Especially if you have a computer with efi\uefi.
Total:
/ boot per gigabyte will be for the eyes. So much in case your distribution suddenly backs up all the kernels when updating.
/gigabyte 30
/home everything else.
By the way, creating a swap, even with a partition, even with a file, does not make sense for more than half of the amount of RAM. Exceptions of course if the amount of RAM is less than 2GB.
A separate /home is needed if you reinstall the system.
For a swap, 5-10 GB is enough.
For /home - 100-120 GB.
Swap is needed for hibernation, right? IMHO, a separate partition is then better (if this is not a prerequisite at all), and the size is not less than the amount of physical memory. If sleep mode is not needed, then leave it in a couple of gigs or less. If there is not enough RAM (well, for a desktop less than 1GB is already extremely small, 2GB is small but tolerable) - then swap will not save. Everything will just slow down. Without it at all - there is a chance to run into an OOM (out of memory, lack of memory) situation, and this, as a rule, ends with a freeze or crash of programs. A little easier with earlyOOM or equivalent.
/boot may not be enough gigabytes. Many distributions keep 5 or more of the latest kernels, and even add boots with them to the grub menu. I don't boot a separate partition unless it's an efi system.
/- the root partition needs to be done in 15-20 gigs, no less. Of course, depending on how busy, who has what needs. But I myself ran into a situation (and more than once) that when updating, the package manager downloaded new packages, but could no longer install them - the downloaded updates took up the rest of the space in the root. I had to clean up and remove a few unnecessary packages, and clean up the logs (by the way, it turned out to be the most of them, because I did not set up anything at all in this regard).
There is also an interesting nuance, nowhere (seemingly) described - when the system is installed (from a disk, or a flash drive), by default, paths to local sources are written in the package manager - to this disk, flash drive, etc. But this is very inconvenient - when the system has been standing for a long time, and suddenly some package needed to be installed - and the system requires you to insert the disk / flash drive that it was installed with. Therefore, I immediately copy all the contents of the disk to the hard disk (or ssd, it doesn’t matter), and rewrite the paths to these folders. Immediately add another 4 or more GB for these things. Of course, you can leave only the repositories on the Internet, but not for everyone and this is always suitable (local machine, expensive traffic, or a computer on an internal network without the Internet).
/homefor user home directories. All data (pictures, documents, etc.) and system settings (user) are there. Accordingly, if you need to reinstall the system, it is enough to format the root partition and reinstall the system and the same packages that were. And the settings will remain the same - if during installation you create the same user that you were before. I switched many times from one distribution kit to a newer one, with the preservation of almost all settings (up to the design and wallpaper on the desktop).
It strongly depends on the goals and objectives of the target system, on what will be used on it.
- If you are going to make a multiboot (several linux OSes to play with), you can / need to allocate a separate /boot partition.
- If you will use it at home (play around, watch movies) - allocate maximum space to /home
- If you use a bunch of different software, you need to provide /opt and /usr
- If there is a database server, then all free space is on /var.
If you cleanly install for a week to "feel" - you can allocate everything to the root and that's it.
Additional opinion: if there is enough RAM, you can not bother with swap.
Additional opinion2: I allocate almost all free space to a separate folder /WorkFolder, and then I make symlinks in the right places
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question