What are the pros and cons of having one partition or multiple partitions?
Hi,
What are the pros and cons of having one partition or multiple partitions? In other words:
- having only root (
/) and/swapor /,/boot,/home, and/swapas separate partitions?
Also if your system had two (or more) disks, what partitioning scheme and directory mapping would you use?
And this is for the purpose of my home workstation, not an organization PC.
Finally is it possible to have more than one EFI System Partition, one per disk, on a given system?
I think at the moment one of my disks has an EFI as well as Windows 10 and the other one its own EFI parition as well as KaOS partitions.
Thanks in advance.
About this post
- Posted
- Archived
- Score
- 11 · 100% up
- Kind
- Text
- ID
- 4ek4wt
60 comments
I always separate
/and/homefor easy reinstalling and backup and because I can set up/homewithnoexecfor security reasons. In reality for end-user setup there are no more partitions necessary.Depends on the storage. If this are two HDDs I'd use the larger one for
/homeand the smaller one for/. If it's SSD and HDD I'd use the SSD for/because of performance.I'd wager it'd be better to put your /home on the ssd.. All your configs, cache, and everyday usage is done in your home folder, speeding up general usage.
Then you could partition the HDD and mount one of the partitions to /mnt/data for large data storage (media, etc).
Edit: personally, I have / on the ssd, and my spinning disk is mounted entirely on /mnt/data. Just personal preference I guess =}
Cache is held in the RAM and gets written in the background anyway. I prefer fast startup of tools over fast writing cache to storage. And loading a few kB small config file isn't that important to me when there will be a few MB large binary file to load. But that might be psychological because nowadays the bus will be the real bottleneck.
I agree about
/homebeing in ssd:In systems without enough RAM you'd want to build packages outside of
/tmp/so the easiest solution is to build them in your homedir. Of course you probably can set up a custom dir somewhere in/.Apps during startup sometimes need to read lots of stuff from
~/.configand~/.cache. In my pc:~/.vimis 200MB.wine apps need to start from ~/.wine.
locally installed npm packages, virtualenvs, fonts, apps (
~/.local/bin).or just put both on ssd and keep your multimedia files on hdds... it's not like they are that expensive anymore... 250gb and 500gb models should be affordable for most and are quite cheap (250gb especially) and should be enough......
Don't buy anything smaller than 250gb as the performance is lower since they don't have enough flash chips for the controller to do it's magic (inside a ssd is a raid 0 array of flash chips, anything below 250gb has 4 channels, others have at least 8). After 8 flash chips the bus becomes the bottleneck that's why ssds are slowly moving away from sata and why you don't really see speeds above ~500mb/s from any sata ssd (the more expensive models do have faster writes, more iops, faster random reads/writes and more endurance than the cheap ones).
I have 110 GB SSD for /, 3 TB HDD for /home (noexec and I actually use the system as multi-user system) and another 10 TB HDD for storage.
I personally have a bigger / than /home, mostly because I kept running out of storage when installing stuff with pacman
I have a 128 GB SSD for
/and a 3 TB HDD that I use entirely for/home.Thanks!
Big pro for having a seperate
/bootpartition: Full-Disk encryption.You can have
/booton/and still do full disk encryption.You need an EFI system partition anyway, so just give that one 300MB and leave it as /boot.
But only with Grub, can't you? And Grub is... meeh for other reasons.
Could you please elaborate?
Sorry for taking so long to respond!
It's not that complicated.
Encryption/Decryption is done by the linux kernel. When your PC boots, first the booloader (grub, syslinux, whatever) gets loaded. The bootloader subsequently loads the linux kernel, which resides in
/boot. If your boot partition is encrypted, the bootloader can't find the kernel, because it first should get decrypted by the kernel.As pointed out by others, Grub somehow has a solution to this, meaning it has built in encryption-support. But I don't like Grub, so this means a seperate boot partition for me!
Cons: Resizing a partition because you allotted to little space to it is painful
Some filesystems are meant to cater to resizing better aren't they? Sure would be useful :) Or are you saying it's still painful even then? I've not had to resize yet but kept some extra space in case.
Let's suppose you have two partitions, A and B in this order on the disk. A is getting full and B has some space. You can shrink B, but this won't allow you to extend A directly because the space you freed is after B, not between A and B. You first must move B to the right, and this is a potentially long and very risky operation.
What FS is suitable for this use case?
Partitioning and File systems are your allies. Reiser4 was supposed to be more efficient for /var, but it is pretty negligible and lately it did not play nicely with journaling - in hindsight I would skip it. That being said, a ntfs partition for a dualboot with Windows is pretty useful.
Edit: see ropid's reply below instead of reading this.
On an SSD there isn't really a point in having a separate / and /home, etc. unless you're using ABS or gentoo then it's wise to have /var on a separate partition so you don't reach the maximum inode limit.
However on a mechanical drive, the original reason is due to data placement: the first partition is nearest the centre of the disk, this means seek time is lower than if it's on the outside of the disk. So if you have separate partitions it makes loading the OS and programs quicker. Another similar trick is some hard drive manufacturers allow you to set the maximum size of the disk (no not increase it but decrease it), generally only with business/enterprise class SCSI drives. This was again used to speed up reading as the smaller drive size means you don't get as close to the edge of the disk meaning seek times are faster.
You mixed things up a little with the inner and outer parts of the disc. The outer parts are faster than the inner parts. What you write about the first partition being the fastest is still true, because the "start" is towards the outer edge, not towards the center.
Here's a screenshot about a HDD I have from that benchmark thingy in Gnome's "Disks" tool:
http://i.imgur.com/r8m0a5g.png
The blue line is transfer speed with the scale on the left, the green dots is seek time with the scale on the right. The transfer speed difference is pretty spectacular. The seek times seem to stay the same.
Nice, not really sure why I thought the inside would be faster, added an edit to my original post.
One reason if for easy reinstall or having multiple installations using the same /home.
IMHO main thing is portability.
If you have separated partitions, you can do whatever you want with the others and nothing would to your /home for instance. encrypt some of them and not all of them. Have the ability to quickly move any one of the parts from a different drive. (bought a new ssd, quickly move your /home to it, without real downtime). Partition wide backups etc. etc. etc.
True, but if you use btrfs subvolumes, you get the same effect with the advantage of snapshots.
I run BTRFS so everything is on one partition.
I see no cons with my usage.
Can you explain how BTRFS makes it better as one partition instead of say you were using EXT4? Is it the subvolume feature? Do you still have the
/homesplit off from/? For development if you want to avoid problems such as logs filling up/var(I have had some naughty software break and spam large log files before), having this as it's own partition(or subvolume? I'm not familiar with these yet) to prevent it from using up the disk so that other partitions function fine avoiding the system breaking is nice.BTRFS has a number of features that I find to be quite handy and useful. Filesystem snapshots are my number one. But, yes, sub-volumes are handy too.
Also, consider automatically pruning your logs.
I'll answer from a default Red Hat Enterprise Linux perspective:
By default, the RHEL installer uses LVM for partitioning. However, the grub bootloader cannot boot from LVM directly. For this reason, a seperate boot partition and filesystem are created to contain the grub files and initramfs. The rest of the space is formatted as an LVM Physical Volume, a Volume Group is created and then one Logical Volume for the root filesystem.
So basically you end up with a boot filesystem and a root filesystem and this is because of lvm. In other words, there's no particular reason for separate partitions or filesystems unless you have some very specific requirements.
Grub 2 can boot entirely from a LVM LV as I proved last night. Maybe RH uses legacy grub? See here https://wiki.archlinux.org/index.php/LVM#Installing_Arch_Linux_on_LVM
I have everything inside one LV to be clear.
Yep,
But you can't do it in RHEL yet, which is why I gave it as an example of a use case for having more than one partitions.
RHEL 7 Installation Guide
6.14. Installation Destination
6.14.4. Manual Partitioning
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/sect-disk-partitioning-setup-x86.html#sect-custom-partitioning-x86
So maybe that's not a great example from an Arch Linux perspective. A better example might be if you want LUKS encryption. You still need some
/bootfilesystem that will not be encrypted and it is going to need its own partition.I have a separate /boot (also efi), swap (as you can't have a swap file on btrfs), /tmp (in tmpfs), /media (huge btrfs raid10 (let the flamewars start) array on a bunch of hard drives), /vms (xfs on on mdraid), / is and everything else is on one btrfs partition ontop of dm_crypt (some things should have their own subvolumes but I'm to lazy so they don't yet), ~/.cache is on tmpfs, browser profiles are managed by psd and are on their own partitions temporarily, hugepages have their own partition too, and I have a 5GB zram partition just because (32gb ram so it's not like I'm short on it...).
/, boot and swap are on a ssd, /media and vms are on hard drives, the tmpfs stuff is in ram (duh), swap and / are encrypted with dm_crypt, the hdd_stuff isn't as there's no sensitive data there. I'd like a few more hdds and ssds but don't have any more sata ports left.
oh yeah, /var/lib/mysqltmp is tmpfs too
it's perfectly fine to have more than one ESP per disk/system
As per Linuxdirk's comment below, I used to put /home on a separate partition for ease of user data backup, reinstallation, etc.. However, some machines include web space files, IMAP data, etc.. What I do now on all machines is set up 3 partitions:
Then /home is just either a bind mount to /data/home (in /etc/fstab):
or can be a soft link:
This provides maximum flexibility; e.g. putting / on an SSD and /data on a normal disk, or setting up separate software raids for each (I like to use a RAID 1 for / and RAID 5 or 6 for /data).
Deleted before we saved it.
Pros
you can share access on one partition with other users and still have private files
you can shortstroke your HD
if you had a server you could put public content on a separate partition from your private files
anything else that could benefit from having files on separate partitions
Cons
some distros can have issues with having one partition full when others are empty
takes more time to setup handle files
makes a system ore difficult to manage (in my experience)
Not sure about multiple EFI partitions. However, I don't see why not. As long as the different OSs were able to tell which one to boot from which is doable
EDIT: formatting
Deleted before we saved it.