1

I have a RAID array which I have to manually mount every time my computer has rebooted. Is there a way to automate this? Every time my PC starts I type this.

sudo mount /dev/md0 /mnt/raiddrives

I just want Debian to do this automatically.

  • Why are you mounting it on /mnt/raiddrives? You could just use /raiddrives/ instead (or something shorter, like /data). Generally, /mnt/ is mounted itself. – Basile Starynkevitch Jun 27 '15 at 21:09

1 Answers1

8

Add it to /etc/fstab with the appropriate options:

/dev/md0 /mnt/raiddrives ext4 defaults 0 2

The third value is the filesystem type (I've specified ext4 here but you need to use the correct one for your situation), the fourth is the options, the fifth is the dump level (leave it at 0) and the sixth is the filesystem check pass (0 to disable fsck, 1 for the root filesystem, 2 for the others).

dump is a filesystem backup tool, but you're extremely unlikely to use it. (If you're curious, search for it on Unix.SE, another user has been trying to use it recently.)

Filesystem checks are integrity checks performed at system bootup; they make sure the filesystem isn't in a state where it couldn't be mounted, and every once in a while they perform a full check to make sure there are no undetected errors (within the limitations of what can be detected in a filesystem check). These checks are driven by a tool called fsck. On non-systemd systems it is run at boot with the -A parameter to check all the filesystems listed in /etc/fstab; it uses the last field above to determine the order in which to check the filesystems. With systemd this is handled by the systemd-fsck-root and system-fsck services.

The fstab manpage has all the details.

Stephen Kitt
  • 434,908