Posts: 85
Joined: Tue Oct 22, 2013 6:21 am

not mount my usb hard drive

Sun Aug 20, 2017 9:20 am

I have in root cron:

Code: Select all

@reboot mount  -o uid=pi,gid=pi /dev/sda1 /home/pi/folder/ 

Always works to me but for some time not works.
Someone could help me please?

Thanks and sorry for my English!

User avatar
Posts: 2009
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: not mount my usb hard drive

Sun Aug 20, 2017 7:55 pm

Do you have more than one USB storage device connected? If so, the device node (/dev/sda...) may change across reboots.

You may get better results mounting by UUID. You can get that from running

Code: Select all

sudo blkid
You might also want to switch from using cron to using an entry in /etc/fstab and letting the system take care of mounting it.
Attempts to contact me outside of thes forums will be ignored unless signed in triplicate, sent in, sent back, queried, lost, found, subjected to public enquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters

User avatar
Posts: 36578
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: not mount my usb hard drive

Sun Aug 20, 2017 9:27 pm

Even better than an /etc/fstab entry is a systemd xxx.mount file.

Create /etc/systemd/system/home-pi-folder.mount

Code: Select all

Description=Mount /home/pi/folder directory
# Replaces this line in fstab
#/dev/sda   /home/pi/folder  vfat defaults,noatime,x-systemd.automount,uid=pi,gid=pi 0 0
What=/dev/sda1 # CHANGE ME to value from blkid if available
Type=vfat  # CHANGE ME if /dev/sda1 isn't formatted at VFAT

enable that with sudo systemctl enable home-pi-folder.mount
get it active for this boot with sudo systemctl start home-pi-folder.mount
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Return to “Raspbian”