How to Make Extra Disk /home

I have to admit, to be honest, this is not related to EndevourOS, it is about the Sparky rolling edition (KDE Plasma) I just installed on an old laptop!

Why I am asking here? This is where I feel I should ask, where I belong. Here are the people I trust. If you see I should not ask here, simply ignore it. I understand.
But this is the pub anyway.

The laptop I installed it has an SSD where the system is installed, I have a much larger empty HDD which I prefer to use as /home/limo

I noticed something, to mount this HDD I have to enter root password (though I chown it to be owned by me limo:limo - user:group).

I have been reading and reading, trying to find a way to make /home/limo/ to be on the HDD, but unfortunately most of what I read was too long and not to the point… well I didn’t like most of what I found!

I believe it is just a matter of a few commands to:

  • Change the home folder from /home/limo/ on the SSD drive where system installed) to the other HDD at /media/limo/home/ or /media/limo/
  • to get it to be mounted automatically upon boot.
limo@sparky:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0 232.9G  0 disk 
└─sda1   8:1    0 232.9G  0 part /
sdb      8:16   0 465.8G  0 disk 
└─sdb1   8:17   0 465.8G  0 part /media/limo/home
sdc      8:32   1     0B  0 disk 
limo@sparky:~$ 

limo@sparky:~$ inxi -Fxxx
System:
  Host: sparky Kernel: 6.1.0-9-amd64 arch: x86_64 bits: 64 compiler: gcc
    v: 12.2.0 Desktop: KDE Plasma v: 5.27.5 tk: Qt v: 5.15.8 wm: kwin_x11 vt: 7
    dm: SDDM Distro: SparkyLinux 7.0 (Orion-Belt) base: Debian bookworm/sid
Machine:
  Type: Laptop System: FUJITSU product: LIFEBOOK AH531 v: N/A
    serial: <superuser required> Chassis: type: 9 serial: <superuser required>
  Mobo: FUJITSU model: FJNBB0F serial: <superuser required>
    UEFI-[Legacy]: FUJITSU // Phoenix v: 1.32 date: 10/01/2018
Battery:
  ID-1: BAT1 charge: 58.6 Wh (100.0%) condition: 58.6/48.8 Wh (120.0%)
    volts: 12.4 min: 11.1 model: SIMPLO AS10B7E type: Li-ion serial: 1032
    status: full
CPU:
  Info: dual core model: Intel Core i5-2450M bits: 64 type: MT MCP
    smt: enabled arch: Sandy Bridge rev: 7 cache: L1: 128 KiB L2: 512 KiB
    L3: 3 MiB
  Speed (MHz): avg: 1389 high: 3100 min/max: 800/3100 cores: 1: 800 2: 800
    3: 859 4: 3100 bogomips: 19955
  Flags: avx ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
  Device-1: Intel 2nd Generation Core Processor Family Integrated Graphics
    vendor: Fujitsu driver: i915 v: kernel arch: Gen-6 ports: active: LVDS-1
    empty: DP-1,HDMI-A-1,VGA-1 bus-ID: 00:02.0 chip-ID: 8086:0126
    class-ID: 0300
  Device-2: Chicony Fujitsu Integrated Camera type: USB driver: uvcvideo
    bus-ID: 1-1.3:3 chip-ID: 04f2:b213 class-ID: 0e02 serial: SN0001
  Display: x11 server: X.Org v: 1.21.1.7 with: Xwayland v: 22.1.9
    compositor: kwin_x11 driver: X: loaded: modesetting unloaded: fbdev,vesa
    dri: crocus gpu: i915 display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1366x768 s-dpi: 96 s-size: 361x203mm (14.21x7.99")
    s-diag: 414mm (16.31")
  Monitor-1: LVDS-1 model: Seiko Epson 0x5641 res: 1366x768 hz: 60 dpi: 101
    size: 344x193mm (13.54x7.6") diag: 394mm (15.5") modes: 1366x768
  API: OpenGL v: 3.3 Mesa 22.3.6 renderer: Mesa Intel HD Graphics 3000 (SNB
    GT2) direct-render: Yes
Audio:
  Device-1: Intel 6 Series/C200 Series Family High Definition Audio
    vendor: Fujitsu . 6 driver: snd_hda_intel v: kernel bus-ID: 00:1b.0
    chip-ID: 8086:1c20 class-ID: 0403
  API: ALSA v: k6.1.0-9-amd64 status: kernel-api with: aoss
    type: oss-emulator
  Server-1: PulseAudio v: 16.1 status: active
Network:
  Device-1: Intel Centrino Wireless-N 1030 [Rainbow Peak] driver: iwlwifi
    v: kernel pcie: speed: 2.5 GT/s lanes: 1 bus-ID: 01:00.0 chip-ID: 8086:008a
    class-ID: 0280
  IF: wlan0 state: up mac: 4c:eb:42:81:35:03
  Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Fujitsu driver: r8169 v: kernel pcie: speed: 2.5 GT/s lanes: 1
    port: 2000 bus-ID: 07:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: eth0 state: down mac: 5c:9a:d8:63:ee:a5
Bluetooth:
  Device-1: Intel Centrino Advanced-N 6230 Bluetooth adapter type: USB
    driver: btusb v: 0.8 bus-ID: 2-1.4:4 chip-ID: 8086:0189 class-ID: e001
  Report: hciconfig ID: hci0 rfk-id: 0 state: up address: 4C:EB:42:81:35:07
    bt-v: 2.0 lmp-v: 3.0 sub-v: fc00 hci-v: 3.0 rev: 1b07
Drives:
  Local Storage: total: 698.65 GiB used: 8.29 GiB (1.2%)
  ID-1: /dev/sda vendor: Samsung model: SSD 870 EVO 250GB size: 232.89 GiB
    speed: 6.0 Gb/s type: SSD serial: S6P2NX0T316466R rev: 2B6Q scheme: MBR
  ID-2: /dev/sdb vendor: Seagate model: ST9500325AS size: 465.76 GiB
    speed: 3.0 Gb/s type: HDD rpm: 5400 serial: S2WFPAY0 rev: SDM1 scheme: MBR
Partition:
  ID-1: / size: 228.17 GiB used: 8.29 GiB (3.6%) fs: ext4 dev: /dev/sda1
Swap:
  ID-1: swap-1 type: file size: 512 MiB used: 0 KiB (0.0%) priority: -2
    file: /swapfile
Sensors:
  System Temperatures: cpu: 53.0 C mobo: N/A
  Fan Speeds (RPM): N/A
Info:
  Processes: 210 Uptime: 47m wakeups: 1 Memory: 3.74 GiB
  used: 1.63 GiB (43.7%) Init: systemd v: 252 target: graphical (5)
  default: graphical Compilers: gcc: 12.2.0 alt: 12 Packages: pm: dpkg
  pkgs: 2265 Shell: Bash v: 5.2.15 running-in: konsole inxi: 3.3.26
limo@sparky:~$ 

As this is related to file system and boot somehow, so I thought I better ask the experts to tell me exactly how to do it, so not to mess up an installed system.

Maybe as well some user who are running EndeavourOs have the same question and have an extra disk, or someone perhaps got an SSD to have better performance on his old laptop. So, the answer might help others as well.

It is a Linux question not Endeavour specific and not Sparky specific.

I apologize if it is not OK to make such post here, as I said, here are the people I trust the most, again, here I previously got support for some software better than I got from the developer(s) themselves.

Here is where I feel I belong and trust.

I will appreciate any guidance on how to change my home folder to be at the extra HDD not the SSD where system installed.

Thank s again and apologies for any inconvenience.

Well, I can only tell you how I mount my internal HDD as a data disk:

Create mount destination folder:

sudo mkdir -p /mnt/data/

sudo blkid to set the UUI,

then add the following line to /etc/fstab:

UUID=[UUID_of_partition] /mnt/data ext4 defaults,noatime 0 2

sudo mount -a

sudo chown -R $USER:$USER /mnt/data

This works fine for me since many years.

Edit: The folders of the data disk are then only symlinked

inserted /home.

I would not put /home on a HDD, because then the dotfiles are also there, which then only allow slower access.

2 Likes

I agree with this learned gentleman :technologist:

1 Like

There several ways to do this. This is one way to do it. You have a very slow HDD (5400rpm) wich is an antique drive in my option. You should realy consider keeping /home where it is and use this drive only for saving pics and documents on it :slight_smile:

Anyway this is how I do it if I need to.

You first need to format the sdb as ext4 if that what you are using as filesystem. Gparted can be used to do so. Dont change the user:group on it. It will be handled later on.

Mount the drive

sudo mount /dev/sdb1 /mnt

check if you can access the mounted drive : cd /mnt
and ls -ahl to see if you have som files there. Delete lost+found if its present. You don’t need it.

sudo rm -rf lost+found

Then copy your /home to the drive

sudo cp -rp /home/* /mnt
check if the files and folders you have is there with ls

If everything is there then rename /home

sudo mv /home /home.orig

Keep this untill you are sure you have moved /home properly and its working. After that you can delete it.

Create a new /home directory

sudo mkdir /home

Then move to /root

cd /
sudo umount /dev/sdb1
sudo mount /dev/sdb1 /home/

I am using sdb1 here as I asume it’s going to be this after formated the drive. If its not that adjust as needed.

Checking the attributes of the /dev/sdb1 partition

df /dev/sdb1

Create a working backup of fstab

sudo cp /etc/fstab /etc/fstab.orig

Then edit fstab and add the following line.

/dev/sdb1 /home ext4 defaults 0 0

nano /etc/fstab

Save and reboot.

1 Like

Thanks a lot @Balder
Trying to do as you mentioned, but I found many UUID, not sure which one to use.

I got:

limo@sparky:~$ grep limo /etc/passwd
limo:x:1000:1001:limo:/home/limo:/bin/bash
limo@sparky:~$ sudo mkdir -p /mnt/data/
[sudo] password for limo: 
limo@sparky:~$ sudo blkid
/dev/sdb1: LABEL="home" UUID="0b76d97a-78ad-47df-932b-c40494e61a45" UUID_SUB="6946eddc-4c33-4895-93e7-4f52513442c2" BLOCK_SIZE="4096" TYPE="btrfs" PARTUUID="42e30126-01"
/dev/sda1: UUID="60e71c6e-8845-4486-91fb-73c55b407e90" BLOCK_SIZE="4096" TYPE="ext4" PTTYPE="dos" PARTUUID="cab11711-01"
limo@sparky:~$ 

I have the file /etc/fstab

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=60e71c6e-8845-4486-91fb-73c55b407e90 /              ext4    defaults,noatime,discard 0 1
/swapfile                                 swap           swap    defaults,noatime 0 0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0

and

So, as @Balder and @r0ckhopper (who agreed with @Balder ) and @boxer Who got it right, Yes it is an antique laptop, like 10 years old or more!

So, I better keep /home where is it and use this HDD as a backup (in case I reinstall or something happens)

So, now I am only left with making the HDD get mounted automatically. I did a few of what @Balder mentioned but not sure what UUID I should use in the file.

Amazing commumity as I expected and as I know it. This why I asked here.
Thank you all.

Reading again slowly, I guess it should be UUID="0b76d97a-78ad-47df-932b-c40494e61a45" Right?
and

UUID=[UUID_of_partition] /mnt/data ext4 defaults,noatime 0 2

Should rather be

UUID="0b76d97a-78ad-47df-932b-c40494e61a45" /mnt/data BTRFS defaults,noatime 0 2

as I formatted it as BTRFS, or should I reformat it as EXT4?

I only formatted my system partion as Btrfs, for the data disk ext4 should be fine. At least I see no reason to go to Btrfs there. But why not?

Otherwise you can do everything as @boxer writes.

1 Like

Reformatted EXT4 as I got unknown file system:

limo@sparky:~$ sudo mount -a
[sudo] password for limo: 
mount: /mnt/data: unknown filesystem type 'BTRFS'.
       dmesg(1) may have more information after failed mount system call.
mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
limo@sparky:~$ systemctl daemon-reload
limo@sparky:~$ sudo mount -a
mount: /mnt/data: unknown filesystem type 'BTRFS'.
       dmesg(1) may have more information after failed mount system call.
limo@sparky:~$ 

The file now reads:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=60e71c6e-8845-4486-91fb-73c55b407e90 /              ext4    defaults,noatime,discard 0 1
/swapfile                                 swap           swap    defaults,noatime 0 0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0
UUID="0b76d97a-78ad-47df-932b-c40494e61a45" /mnt/data ext4 defaults,noatime 0 2

But getting:

imo@sparky:~$ systemctl daemon-reload
limo@sparky:~$ sudo mount -a
mount: /mnt/data: unknown filesystem type 'BTRFS'.
       dmesg(1) may have more information after failed mount system call.
limo@sparky:~$ systemctl daemon-reload
limo@sparky:~$ sudo mount -a
mount: /mnt/data: can't find UUID="0b76d97a-78ad-47df-932b-c40494e61a45".
limo@sparky:~$ 

Sorry! Easy on me please! I am missing and messing something?
I reformatted the HDD as Ext4.

Now the point is just to mount the HDD automatically. I will keep /home as it is on SSD.

What is the output of lsblk -pf ?

1 Like

Rebooted (just out of curiosity) in hope it will work. But no boot!
I will try boot from flash disk and try return the file as it was and see. If not I will reinstall!

Sorry, it seems I have messed things up!

Boot from a live system and delete fstab and restore fstab.orig by renaming it to fstab first. Then reboot. Or just comment out the line with

like this
#UUID=“0b76d97a-78ad-47df-932b-c40494e61a45” /mnt/data ext4 defaults,noatime 0 2

and save fstab.
Then reboot

BTW…

Did you get to root shell?

1 Like

Not even root shell! It was like trying to boot or mount a drive all the time!
Update:
Rebooted a while ago and went to do a few things. Now I got a prompt, entered root password and I have a prompt as root root@sparky:
Done! Commented out the line I added and I could boot again! But the HDD is again root:root

So. as you suggested earlier I would keep /home as is.
I now just need to mount the HDD automatically and make it owned by limo:limo

How can I do this?

sudo chown -R $USER:$USER [path/to/the/device]

You can use symlinks (shortcuts) in your /home pointing to folders in /mnt/data so they’re part of /home, but physically on the other disk.

1 Like

Done!
How to automount it? It still asks for root password.

If you have entered the partition of the HDD correctly in the fstab, you do NOT need a password! Then you have what wrong it stand in the fstab! Entry fstab see my posting above.

1 Like

No need to set the owner as user.

Look at mine
sharedperm

This is my shared folder where i mount my exfat drive. Root owns it. But it can be fixed with flags in fstab.

Like this:

/dev/sda4 /run/media/shared exfat defaults,auto,umask=000,users,rw 0 0

In your case this would be:

/dev/sdb1 /mnt/data ext4 defaults,auto,umask=000,users,rw 0 0

No need for UUID. Use device paths.
So delete the data folder in /mnt and create a new folder there in terminal like this:

sudo mkdir /mnt/data

Don’t change the permissions. It will work fine.
Then put the above line in fstab.

Save and sudo mount -a or reboot

1 Like

Finally done!
I can now boot normally and have the HDD automounted.
Thank you @anon50380917 , @boxer , @r0ckhopper , @vazicebon

A wonderful community as expected. Thank you all

I do it the same way as @anon50380917 suggests:

I just mount the HDD normally with fstab, create a bunch of directories (for Documents, Downloads, Pictures, etc…) on it and create symlinks to them in my home directory.

It’s really the simplest and most flexible way to do it.

1 Like

Thanks to you all, I am using my old laptop as my self hosted cloud storage. (700GB)
I -as you advised- saved the movies to the HDD, others to the SSD
Using resilio sync (unfortunately syncthing has no free iOS app)
Same time I am backing up my /home folder on my main laptop (EndeavourOS) to the other laptop. Just in case.

Thank you all for all your support.

2 Likes