1

First up I should note that I have no coding experience and am following guides.

I'm currently setting up a RaspPi with Raspbian as a Plex server. Plex setup worked fine and I was able to mount the network hard drive (Seagate Central). Plex found files, good job.

However, on rebooting the Pi I lost the mount. After a bit of research it seems I need the disks UUID to mount on booting. For the life of me I cant find it.

Everything i read says to use command "blkid", which gives me the following;

/dev/mmcblk0p1: LABEL="RECOVERY" UUID="59B0-FB97" TYPE="vfat" PARTUUID="0007d388-01"
/dev/mmcblk0p5: LABEL="SETTINGS" UUID="85322d63-7f1f-4824-8ef3-5bc01a18c28d" TYPE="ext4" PARTUUID="0007d388-05"
/dev/mmcblk0p6: LABEL="boot" UUID="D702-6842" TYPE="vfat" PARTUUID="0007d388-06"
/dev/mmcblk0p7: LABEL="root0" UUID="914a5b49-882d-406d-9ae7-d6e7d4b9e2c5" TYPE="ext4" PARTUUID="0007d388-07"
/dev/mmcblk0: PTUUID="0007d388" PTTYPE="dos"

command "df -T" gives me this; (other filesystems removed for space)

//'ipaddress'/boland cifs     3886415808 2625757376 1260658432  68% /media/HARDDRIVE

Just in case you need it, I mounted the drive using;

mkdir /media/HARDDRIVE

sudo mount -t cifs -o username=x,password=x //ipaddress/boland /media/HARDDRIVE 

I'm on struggle street here, can i please get some help finding the UUID. Alternatively if there is a way to mount on boot without the UUID that would be great.

Thanks, Andrew

  • 1
    Network mounts do not use UUIDs. – onion Feb 28 '18 at 9:10
  • Any advice on how I would go about this then? – Boland Feb 28 '18 at 9:18
0

There are two different solutions, one fstab solution and one systemd solution.

fstab Solution

You need to add your mounts to /etc/fstab to be mounted at startup.

For your example you need a line like

//ipaddress/boland  /media/HARDDRIVE  cifs  credentials=/etc/credentials,rw  0  0

in your fstab. Additionally you need a credentials file (/etc/credentials in my example):

username=x
password=x
domain=.

The credentials file should be readable only by root so change the rights with

chmod go-rwx /etc/credentials

systemd Solution

When the fstab solution above does not work you have to create mount units for systemd.

Create a file media-HARDDRIVE.mount in /etc/systemd/system with the following content:

[Unit]
Description=Mount smb share
Wants=network-online.service
After=network-online.service

[Mount]
What=//ipaddress/boland
Where=/media/HARDDRIVE
Type=cifs
Options=noauto,rw,credentials=/etc/cred

The credentials file can be the same as in solution 1.

Next create a file media-HARDDRIVE.automount in /etc/systemd/system with the following content:

[Unit]
Description=Automount smb share

[Automount]
Where=/media/HARDDRIVE

[Install]
WantedBy=network.target

Next enable the mounting units with

sudo systemctl enable mnt-HARDDRIVE.automount
sudo systemctl daemon-reload

Now you can immediately mount the share with

sudo systemctl start mnt-HARDDRIVE.automount

After a reboot the share should now be mounted.

The file name of the mount unit must match the path to mount with escapes. To create the proper file name you can use the tool systemd-escape media/HARDDRIVE with the mount path name without leading /.


Explanation of the file /etc/fstab:

The file /etc/fstab contains the filesystems that will be mounted at boot time (there is a flag to disable this but this is a simple explanation). It basically has the following format:

what  where  type  options  freq  pass

The what indicates what will be mounted and the where where it will be mounted. The type indicates the fs-type and the options are th mounting options (which are specific to the fs-type). The freq is used for backup of ext2/ext3 filesystems (and should be set to 0 if you use any other fs). The last field pass is used to determine the order of the filesystem checks. For remote filesystems this should be set to 0 because no fs-check is needed.

| improve this answer | |
  • Comments are not for extended discussion; this conversation has been moved to chat. – Ghanima Mar 2 '18 at 18:09
  • Thank Uwe Plonus. Got there by installing Raspbian directly and using your NOOBS solution on top. Legend! – Boland Mar 10 '18 at 5:37
  • For information: the systemd solution was named NOOBS solution before. – Uwe Plonus Mar 10 '18 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.