SDB:Mount additional disk
Introduction
If your computer has multiple disks:
- A(/dev/sda): a super fast SSD for system (/) and user data (/home)
- B(/dev/sdb): a slower, older SSD, you still want to use (one single XFS partition)
- C(/dev/sdc): a 2TB HDD for all your old files (one single XFS partition)
When you install openSUSE on disk A, partitions on disk B and C will not be mounted when system starts. This means you have to manually mount each disk before accessing data inside. When you click disk name on file manager (Dolphin or Nautilus), and type root password, the disk will be mounted in a long path, like /run/media/jimmy/7d423ba2-96bf-4493-acf9-ed22e897eed5/
This is not very convenient. We might want:
- Disk B and C will be automatically mounted when system boot
- Disk B and C will be mounted at /home/jimmy/SSD1 and /home/jimmy/HHD1
- Do not require root password every time
Next section, we will achieve this in several simple steps.
Steps
Step 1: find UUID of your disks
In Dolphin or Nautilus file manager, click and mount your additional disk partitions. In address bar, you can find mount path like:
/run/media/jimmy/7d423ba2-96bf-4493-acf9-ed22e897eed5/
7d423ba2-96bf-4493-acf9-ed22e897eed5 is the UUID of the disk partition we need in next step.
Setp 2: edit /etc/fstab
sudo vi /etc/fstab
Then add a new line at the end of file:
UUID=7d423ba2-96bf-4493-acf9-ed22e897eed5 /home/jimmy/SSD1 xfs defaults 1 2
- 7d423ba2-96bf-4493-acf9-ed22e897eed5 - your actual disk partition UUID.
- /home/jimmy/SSD1 - where you want to mount the partition
- xfs - file system of the partition
- defaults - read and write options, do not need to change
- 1 - if it should be dumped, do not need to change
- 2 - the order of file system check, do not need to change
Step 3: mount partition and test
sudo mkdir /home/jimmy/SSD1 sudo mount /home/jimmy/SSD1 sudo chown jimmy:users /home/jimmy/SSD1
Open file manager, try copy or move files in new mount point /home/jimmy/SSD1
If this succeeded, try to mount other disk partitions.
FAQ
How could I change mount point?
First, unmount current mount point:
sudo umount /home/jimmy/SSD1
Second, edit /etc/fstab and set new mount point:
sudo vi /etc/fstab
UUID=7d423ba2-96bf-4493-acf9-ed22e897eed5 /home/jimmy/data xfs defaults 1 2
Third, mount again:
sudo mkdir /home/jimmy/data sudo mount /home/jimmy/data sudo chown jimmy:users /home/jimmy/data
How to unmount and uninstall disk?
sudo umount /home/jimmy/data sudo rmdir /home/jimmy/data
Helpful links
- Correct way to mount a hard drive, Stack Exchange