this post was submitted on 27 Apr 2024
29 points (96.8% liked)

Linux

47952 readers
1795 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Hi, I'm just starting exploring btrfs volume concepts; currently my testing setup has three subvolumes: root, var, home; is it possible have user home folder (I mean /home/user, not all /home) in a different partition? Thanks for suggestions

top 10 comments
sorted by: hot top controversial new old
[–] nous@programming.dev 11 points 6 months ago (1 children)

The Linux directory system is a single tree from the root /. You can mount any filesystem to any directory inside it to extend it and have all writes to that location be handled by that FS. This is all irrespective of what filesystem the is present at that location in the tree. It does not matter if it is BTRFS, ext4 or anything else mounting a filesystem into the directory structure is handled by the kernel separately from the FS implementation. So, yes, you can mount any partition that contains a filesystem to /home/user no matter what you have done with / or even /home.

But, any writes to that location will be handled by the filesystem driver for that partition. So any subvolumes or anything else the main filesystem/partition has wont be available inside that directory. You can have a BTRFS filesystem mounted there from a separate partition if you want. Though a big benefit of BTRFS is the ability to use subvolumes instead of full partitions so you are not segregating the space on the disk (ie, any subvolume can use what space it requires and you wont have one running out of space because you didn't make it large enough). So if you are going for BTRFS subvolumes I would just have one main partition and use subvolumes to split up the space if you wish. Though really the only benefit to that is you can snapshot them separately and I think you can set different quotas and settings on each one.

[–] gcala@lemmy.ml 2 points 6 months ago (1 children)

Thanks for the detailed answer. If i go with one partition/multiple subvolumes, is it possible create a subvolume for my "user" home that is encrypted with luks?

[–] nous@programming.dev 3 points 6 months ago* (last edited 6 months ago)

subvolumes are integral to btrfs. You cannot have a layer like luks between them. You can encrypt the whole partition with luks before btrfs or you can encrypt specific directories after btrfs with something like encfs or truecrypt, though doing so loses some of the benefits of btrfs as it can no longer see your individual files.

If you wanted just /home encrypted with luks it would need to be a separate partition (which you could then have btrfs inside with subvolumns on that). Though IMO that gets a bit complicated - I would just opt for encrypting everything (except boot) on the root partition and have one btrfs fs on that partition with as many subvolumes inside that as you like.

[–] jaykay@lemmy.zip 3 points 6 months ago

Im pretty sure you can, afaik you can nest subvolumes

[–] possiblylinux127@lemmy.zip 2 points 6 months ago

I would but /home in a btrfs subvolme and / (root) in another subvolume. That's how Fedora does it and its worked fine for years

[–] Ephera@lemmy.ml 1 points 6 months ago* (last edited 6 months ago) (1 children)

openSUSE used to have the /home folder (so, not a specific user subfolder) on a different partition as the default setup some years ago, with 40 GB for the root partition.

They changed it, because it meant people's root partitions would sometimes fill up from the snapshots being stored there and that's really annoying to recover from.
Not only can a full root partition irreparably damage your Linux system, it also meant that people would try to uninstall packages to free up space, which wouldn't actually free up space, because those packages were still contained in differential snapshots.

To actually free up space, you have to either delete old snapshots (so that there's less difference to your current install) or delete intermediate snapshots where you happened to install a load of packages, which you uninstalled afterwards.

[–] gcala@lemmy.ml 1 points 6 months ago (2 children)

I'm not asking this for limited space. My long term purpose is having just my home with granted space and luks encryption (and obviously decryption on login).

[–] Ephera@lemmy.ml 1 points 6 months ago* (last edited 6 months ago)

Hmm, as in you only want your home-partition to be encrypted, nothing else? Because you can do filesystem encryption for the entire btrfs (including both root and home) and that works perfectly fine.

Not sure, if it uses LUKS for that, but there's an option in the installer for encryption...

[–] just_another_person@lemmy.world 1 points 6 months ago

Yes. This is not a btrfs feature, it's just a partitioning scheme. Lots of people keep their /home on a different partition for easy portability.

Example: you have two 1TB nvme drives on your machine, and you're planning on downloading a lot of games from Steam, but also might switch distros. Separate /home partition allows you a simple space to do all this, and also wipe out your OS installed on the / drive, and install a new one. Just have to mount your existing/home during, or after installs.