4

I'm using Fedora 23 with KDE Plasma. I'd like to mount automatically my hard-drive at start-up. Here is a screenshot of my situation :

Screenshot of Dolphin mounting my hard-drive

Any idea ?

Thanks

2 Answers2

7

To have a device mounted on startup, you need to edit /etc/fstab as root. The format for /etc/fstab is as follows:

# <file system> <mount point> <type> <options> <dump> <pass>

  • <file system> is the device or remote filesystem you want to mount.
  • <mount point> is where you would like your device or remote file system to be mounted.
  • <type> is the type of the filesystem you are mounted. (ext4, FAT, NTFS, etc.)
  • <options> are the mount options associated with the filesystem.
    • A common option is defaults, which mounts the filesystem with rw, suid, dev, exec, auto, nouser, async, and relatime. To view available options and option descriptions, look at the man page for mount(8).
  • <dump> is a boolean that determines if the filesystem needs to be dumped or not. Most of the time this value is 0. dump(8)
  • <pass> determines the order in which filesystem checks are done at reboot time. It is common practice to have the root filesystem have a value of 1, and all other filesystems have a value of 2.

For example: Let's say I have a device plugged into /dev/sdb1 with an ext4 filesystem which I would like to be mounted to /mnt/files on boot.

I would add the following line to /etc/fstab:

# <file system>    <mount point>    <type>    <options>    <dump>    <pass>
/dev/sdb1          /mnt/files       ext4      defaults     0         2

Note: Comments in /etc/fstab are specified with a #. The top line in the example above is not necessary, but it is good practice to keep it in the file so you can remember the format.


There is a man page for everything I just said. If you want more information, take a look at the man page for fstab(5).

Peschke
  • 4,148
  • Seems to be out of date, nowadays it's more something like: UUID=a32880a5-6833-4341-b5f3-119765bd916c / btrfs subvol=root,compress=zstd:1 0 0 – jaques-sam Apr 18 '23 at 11:45
0

For anyone attempting to do this on Fedora 38 (KDE) and want a GUI way to do this, go to the following settings menu:

System Settings -> Removable Storage -> Removable Devices

Then select automount on login (or "on attach" if preferred) for all known devices. Much easier than having to manually edit fstab.

AdminBee
  • 22,803