0

My computer has two disks:

  1. 256 GB SSD
  2. 4 TB SSD

I have Linux installed on the 256 GB SSD. So / is mounted on it.

I want /home and /data to both be on the 4 TB SSD. But I don't want to create two partitions. I want everything in one partition.

Is this possible?

Edit:

  • I don't want two partitions cause I don't want to have to muck with or worry about space. I want both /home and /data to fill up as much of the 4 TB as they need. On Windows, the 4 TB showed up as D: and I moved my home folder to D:\home and also had a D:\data.
  • I don't want /home and /data to show the same directory structure. They are unique folders, each with their own content.
  • If necessary, I am willing to do a clean/fresh install and format all my disks to configure them how they need to be.
  • Before my computer had Linux, I was running Windows 10. I've wiped Windows 10 and moved to Linux. There is no Windows on this system anymore.
  • I don't care what the partition scheme is as long as it makes sense.
  • /data is intended to be read/write by any user -- if that matters.

Here is my /etc/fstab right now:

UUID=... /               ext4    errors=remount-ro 0       1
UUID=...                            /boot/efi       vfat    umask=0077      0       1
UUID=... /home           ext4    defaults        0       2
UUID=... none            swap    sw              0       0

Here is the output of lsblkl:

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0   3.6T  0 disk 
└─sda1        8:1    0   3.6T  0 part /home
nvme0n1     259:0    0 238.5G  0 disk 
├─nvme0n1p1 259:1    0   512M  0 part /boot/efi
├─nvme0n1p2 259:2    0   237G  0 part /
└─nvme0n1p3 259:3    0   977M  0 part [SWAP]

1 Answers1

2

With all three solutions the free disk space is shared between /home and /data.

Filesystem-agnostic solution

  1. Create a single partition and format it with a single filesystem
  2. Mount that filesystem to a temporary directory, like /mnt/storage
  3. Create two subdirectories: home and data
  4. Bind-mount each subdirectory to its respective mountpoint

Bind-mounts make directory's contents appear at another place in the hierarchy. It's like a regular mount, except the source is not a filesystem, but an existing place in the hierarchy. They can be created with mount --bind or using the bind option in fstab.

Original subdirectories under /mnt/storage will still be available.

btrfs

With btrfs you can avoid mounting the root filesystem:

  1. Create a single partition
  2. Create a btrfs filesystem
  3. Create two subvolumes: @home and @data
  4. Mount each subvolume on its respective mountpoint using the subvol option to mount or in fstab

This way the root filesystem won't be mounted anywhere.

ZFS

Also without exposing the root:

  1. Optionally: create a single partition
  2. Create a zpool from the drive (or partition). This will create a ZFS filesystem by the same name
  3. Create two filesystems tank/home and tank/data (assuming the zpool was named tank
  4. Set mountpoints for these two filesystems
  5. Disable automounting for the tank filesystem
gronostaj
  • 58,482