Is there a point to partitioning anymore?

I got some drives recently and, about to repurpose some old parts as a NAS (via linux obviously).

The boot drive is an SSD - 512 gig. MUCH more than the OS is ever going to need.

Now I wonder - should I partition most of it as a usable network share or just leave it as 1 partition and simply share a folder on the file system?

I mean there are some minor pros and cons to either - having as much usable space as possible, vs potentially overfilling the drive. But those seem so minor and edge-casey, I wonder if there’s even a point to partitions anymore.

Would appreciate some insights.

For a personal or home machine I don’t really see the point in it.

For servers, maybe?

Overfilling the drive is the only thing that comes to mind offhand for me also, but yeah, if you’re so lucky as to be setting up a completely new box that has no legacy cruft attached to it, then there’s probably better ways around that also.

1 Like

Use btrfs, and give one fs all the space, other than possibly an ESP or a swap partition.

Subvolumes replace partitions. I sometimes have 5 or 6 installs in one btrfs.

2 Likes

Pretty much dead. No use to me for a home system, and any server systems are almost 100% going to be using block storage, or very specific configurations for OS and then Data

3 Likes

Been reading up. This whole project represents an opportunity for me to finally, properly, really get into linux.

Coming from windows I found it exceedingly weird how swap works. It’s so easy in win-land. You have 1 swap file and you can configure it as desired - either auto, a set size, or even a range of sizes, so that it will stay small when unnecessary, or balloon as required to take oversized commit. This is how I have it set up - so it does not eat up precious SSD space, while being able to allow full use of physical RAM (seeing as how windows does not permit overcommit). On the other hand linux has overcommit, so this mechanism is less important.

In contrast dedicating a whole partition to swap seems so weird to me. And as I am reading btrfs docs, I turns out it supports swap files, however you cannot snapshot volumes with swap files.

So right now I’m wondering - do I even need snapshotting of my boot drive for any particular reason? Which is related to the question - should I reserve a swap partition (if it matters: system has 16 gigs of ram).

You generally don’t want to snapshot a volume containing swap as this will eat up your disk space really fast. Using a swap file isn’t file system related you can use any kind of block storage for the swap, whether that’s an actual disk or a file.

1 Like

If you have unreliable shared users of your local computer: family members, friends, roommates, etc.

I also manually partition root, home and var/log, just in case.

2 Likes

@Dexter_Kane Yea, that did not help at all. More specifically it offers no insight on whether I’d want snapshotting and if so, how big I’d make the swap partition.

@regulareel Do you mean someone who might fill up the volume and botch up the system? Yea, I suppose that’d be a valid concern for a shared drive. I have some other people that will use the NAS, but it’s unlikely they’ll ever be a problem in that regard. And I’m not familiar enough with linux yet to understand why root, home and var/log are important.

1 Like

You want root to be separate so that you can nuke the linux installation and install a new distro while keeping most of your files and app configurations in /home intact. It might introduce some minor config problems but most of your files are intact.

You want the /var/log partitioned because a random error might get into loop and cause the log to fill your entire drive and that would hinder troubleshooting a lot.

4 Likes

A while ago I had an app that was using a disk cache fill up all the inodes in the file system with millions of tiny files such that the system couldn’t allocate any more storage even though it wasn’t out of space on that partition. That caused a ton of garbage to be spewed into the logs which really did fill up the partition.

So yeah, that’s annoying.

2 Likes

Cool. But I have no idea how separately partitioning the root helps with that.

@redocbew Read up on inodes the other day. I find it weird that it’d have such a limit.
But also learned how neatly directory inodes map to what you see - they have an entry for itself, its parent and all children - so ., .., and all children.

I also found out that I most likely have to use btrfs for both the boot drive and storage - because it either provides the union and redundancy functionality, or is required for SnapRAID, which creates parity as a single large file and ext4 only supports files up to 16TB and my data drives happen to be 18TB.

Tho the question still remains:
Does a NAS boot drive have any use case for snapshotting? And if I need a swap partition, what’s a good size on a 16 gig machine in linux? (Expected usage being little more than hosting a bunch of network services like samba, a personal web server, a torrent client and the like - possibly in docker containers? I’m not at that stage yet).

The ubuntu installer for example is very dumb in regard to file systems - even windows is better - at least it offers the option to set the allocation size of the filesystem - which I might want higher for the data drives, which will be full of media files. And btrfs has so many other knobs and levers. Like, I want compression and trim and maybe auto defrag too.

Auto defrag? Like the thing that people used to do on hard disks twenty years ago? SSDs don’t need defragmenting. If you defrag a SSD you’re just wearing it down for no reason.

With the (low) price of RAM nowadays, have you considered just getting more and then doing away with swap altogether? I haven’t had a swap partition or file for over a decade. Unless you are doing weird/unpredictable things on your system, you just don’t need it.

https://btrfs.readthedocs.io/en/latest/Defragmentation.html

Defragmenting still has a place today. Windows defrags drives automatically during idle time. Nobody talks about it, because it works transparently in the background.

The manual is aware of the point you’re making, but still notes that it can be useful even on SSDs. ext4 and NTFS are journaling file systems, but btrfs is a Copy-on-Write fs, which apparently introduces additional fragmentation. This article has a good visualisation of the semantics of Copy-on-Write.

With the (low) price of RAM nowadays, have you considered just getting more

No, I have not. I made the machine out of some old parts. Getting more would necessitate replacing the entire guts of the computer. This would not be cheap and would in fact defeat the purpose of attempting to put said old parts to use.

1 Like

Usually you’ll never get near it, and it depends on the file system what the limit is.

In the example I mentioned the system was spending an inordinate amount of time writing files to disk which kind of defeated the purpose of having a cache in the first place, so it needed some attention regardless of the limit.

" … Is there a point to partitioning anymore? … "

Yes.

But it depends. On things like control and preference.

I still set up separate partitions, /, /swap and /home ( /home usually on separate drive if I can ), because I’m old and have been using Linux for going on 25 years, and that’s the way it was done all those years ago ( old dog ). It’s habit. And it still works for me.

Is it more work, takes longer? No clue. Been doing it the same way for so long. And my “production” OS has been SuSE/opensuse for most of it. From what I’ve seen, “new user friendly” distros don’t always allow for the control that I like, or my preferences. And distros more advanced ( Arch, Slackware, Gento ), are more work then I want to put in.

Control and preference. So for me the answer is yes. There IS still a point.

Dose that make any sense? Beats the hell out of me. But it works for me and I don’t care if it make sense or not.

I only have /boot and swap, everything else is BTRFS and ZFS. I’m getting too old for partitioning and fdisk and all those headaches.

subvolumes and datasets are the way to go.

I run Tumbleweed, btw! :wink:

For single user systems not a lot of point. Never really was outside of putting your stuff on a seperate /home to survive distribution hopping.

For servers still definitely yes. You can mount partitions read only and no SUID for hardening and runaway storage consumption will not cross a partition boundary. You can also optimise file system options for the intended purpose.

However better to use ZFS or an LVM for more dynamic control of things.

I don’t have much experience with this, but I gather we don’t worry much about swap these days. I set up a swap partition out of habit; I can’t recall swap being used on systems I use other than in testing out of memory conditions since about 2016. (I guess originally a separate swap had a performance advantage.) Ubuntu installs to use a swap file by default.

“boot drive”… if you mean where the OS is installed, absolutely, so you can rollback problematic updates, failed upgrades, or user errors, and to do incremental backups. (I use non-LTS Ubuntu derivatives and they do a sometimes big upgrade twice a year, and it’s good to have both before and after runnable for a while.)
However, doing full encryption might involve a separate /boot. I’ve no experience with that and the way to do things has been changing.

If an install creates a swap file that inhibits snapshotting of the root subvolume I’d find that weird but you can just turn it off, and make one on another subvolume if necessary.

I’ve run out of swap playing with stable diffusion, how much you need really depends on what you’re doing.

1 Like

@georgezilla
You guys talk about how you use separate partitions for /, /swap, /home, /var/log, root or whatever.

But I have no context for any of that. I don’t have the experience to know why this might be good or bad or in what ways.

Btw, I can confirm that ubuntu (which I think is supposed to be newbie friendly) does allow for the control you are looking for at install time. You can mount /, boot, home, tmp, usr, var, srv, opt and usr/local to different partitions.

What I do have is research tho. For example, above I was confused why linux formatting tools do not offer the ability to set block size. But as I learned later, when you consider how files are stored in the filesystem, it doesn’t really matter what the logical block size is. File data is stored in extents - ranges of blocks. Whether that range is large or small (respectively small vs large block size), it’s going to be 2 numbers anyway.
It might have small effect on fragmentation, but it’s unlikely to be relevant. In fact it might be slightly beneficial to keep it small so space isn’t wasted on tiny files (again a small effect).
On average you’ll have (num files)*(half the block size) of wasted space on any drive.

Also read about inodes. Running out is only relevant on ext4. mkfs.ext4 has certain params to control the number of inodes - bytes per inode, or inode_ratio in mke2fs.conf which has several presets based on expected usage.
Ultimately this number effectively means “What is the average file size you expect on your drive?”. For a media drive, you can safely set it at 1 or even 4 megs and reclaim a couple of gigs of metadata.
None of this is relevant for btrfs.

For swap, I decided to reserve 8 gigs as a swap partition (half the physical ram).

Also, I had an idea. On an SSD, the swap partition could potentially function as over-provisioning. But this would depend on how linux handles it. For example if the entire partition is permanently used it wouldn’t work. But if say some bits of data are paged in, then linux tells the drive to free those blocks, then it would work.

Given that I have no idea what to do with a bunch of extra partitions, I decided to just plonk the entire drive (sans swap) on / and be done with it.

1 Like