Hello. I know it’s pretty straight forward to mount an entire partition to /home, but I didn’t really find any examples online of people mounting a subdirectory to /home. So I wanted to double check here to make sure I’m doing it correctly before I reboot my system and end up with an unbootable system.
Steps that I’ve done:
Created a Linux filesystem partition with fdisk
Created an ext4 filesystem with mkfs
Mounted new partition /dev/sda1 to /mnt
Run: cp -rp /home /mnt (I want home to be a subdirectory, not the root of the filesystem)
Added the following entries to /etc/fstab (UUID removed)
And from here the steps that I think I need to do to finish before rebooting:
6. Unmount /dev/sda1 and run mkdir /mnt/sda1
7. Run mv /home /home.old just in case, and then: mkdir /home
8. Ready to reboot?
My questions are:
Is there anything I’m missing?
Can I move /home while logged in? Or do I need to use a live disc?
Well, I’m coming from Windows, so that might offer you some insight into my perspective, and, while yes, the users directory on Windows is on C:, my new system has a 512GB M2 SSD for the OS, and a 4TB HDD for storage. I do not want to clutter the paltry 512 GB with downloads, documents, and other such user files. I want to use the 4TB storage drive for that.
The other concern I have is that I am migrating my files (> 1TB of data) from my old Windows 7 PC to this new PC. I don’t want that data to be locked up/encrypted under a user home directory. I also don’t want to worry about having to rebalance partitions, should my user directory or my storage directory grow in size.
No, while moving (copy+rm) no other process should access the files.
Instead of the live disk, you can switch to rescue target (on the terminal): systemctl isolate rescue.target and do everything on the terminal as root.
Since you use bind, no fsck is needed. So 0 2 → 0 0 and the ext4 partition gets already checked.
nofail,nobootwait is suboptimal here. /home is a part of system, so crazy stuff can happen when it is not there.
I am as crazy as the OP is. I guess he has the same thought as I had…
He has an external HDD, and he bothers to format it just for /home, since he wants to use the partition not only for home, but also for other things. If /home is full, he needs to partition it again, and that can take hours. I totally understand that.
That is a method which mimics the mount of a btrfs subvolume in some way, which is really flexibile.
I’m entirely unfamiliar with this, but a preliminary search on the subject makes it sound like it could replace ext4? But are there any cons to using btrfs? What I read suggests it to be entirely superior to ext4 with features that ext4 doesn’t support, as well as much larger volumes, with many more files, and larger max file sizes. Filesystems aren’t something a Windows user gives any thought since there were no options, it was just NTFS.
Yes, that is correct. In fact, Theodore Ts’o, the maintainer of ext4, said himself that ext4 was only a mild step up from ext3 and a placeholder for btrfs, and that he expects btrfs usage to supersede that of ext4 in the foreseeable future.
Every filesystem has pros and cons. Personally, I’ve been using btrfs on this machine here — which is my production system — since 2019, and I haven’t had any problems with it yet. It’s rock-solid stable and it’s pretty fast too.
Comparing btrfs to ext4 is actually unfair, because btrfs is much more like zfs in terms of its feature set and internal operation.
As I said in my ps before, I might have misunderstood you.
Hence the questions:
Is your goal to use the new disk partition as your /home directory?
Completely replacing what is currently in your /home (and all users in it)?
This is what it looked like to me.
Or do you want to use the new disk partition as some way of expanding available space for your user account
I don’t think so - the copying you did would not have been necessary.
This can be done by mounting the empty disk partition to some directory in /home/user
No. I wanted a subdirectory to be /home, not the partition root.
Yes, I don’t want user files on the OS partition, since it’s a small partition.
Why not? When I installed Manjaro, I only had one drive (and one partition). Under these circumstances, isn’t /home actually a subdirectory of the root partition? I wanted to move /home to /other-volume/home, and then bind /other-volume/home to /home. The reasoning, as previously stated, was that I wanted to use /other-volume as more than just a /home directory. I wanted other directories on the volume for other data.
After all, in my eyes, a storage filesystem should be structured to meet the needs of the user.
I hadn’t really considered this as an option, more or less out of ignorance. Also, I was under the impression that the /home/user directories would be encrypted, and I didn’t want my other data to be encrypted. Also my ignorance, if that’s not the case.
Not only “under these circumstances”.
What you don’t seem to grasp is:
The /home directory as such is always part of the / file system structure.
It’s always there.
It can’t be moved - but you can attach a separate storage there - like your new partition.
You can attach your new, bigger partition to this point (mount it to that directory).
You copy all of the content of your current /home directory, which currently is on your original drive,
to this new partition.
Then you attach (mount) that partition, the new disk which now contains what was previously in your /home directory
Voila: you now have all the space on the new disk available for /home - as well as your original content.
I don’t quite understand what you mean by this.
You can always create new directories under /home
They will then also all be on the new drive partition.
Perhaps you can describe your final goal, the structure you want to achieve.
We could then recommend how to achieve that.
And mount additional partitions/devices on those as well. A mountpoint does not have to be a root-level directory.
For instance, the EFI System Partition is commonly mounted on /boot/efi, and the contents of /boot can themselves exist either on the root filesystem or on a separate partition.
To the end-user, it all looks the same, regardless of whether it’s a separate volume or not. That’s what the unified directory hierarchy of UNIX is all about. /boot is /boot and /home is /home, whether its contents live on the root filesystem, on another filesystem on the same computer, or even on a filesystem on a server across the network.