2

I just bought a Raspberry Pi and want to start using it as a NAS.  I'm fairly new to this, but I've gotten this far.

I've got an external hard drive (freshly formatted NTFS) connected with a USB cable to my Raspberry Pi and am connected through SSH terminal (I don’t have an external display to use). Every time my Pi reboots, I have to remount the drive in order to use it.  I added this line to /etc/fstab file:

/dev/sda1   /media/NAS      ntfs-3g    defaults 0       0

For as far as I understand, that’s all I need to make my Raspberry Pi auto mount my USB hard drive as soon as it reboots.

What am I doing wrong?

1 Answers1

0

There are a few things you should try. First is to change the last 0 on that line to 1 or 2 as you only want this mounted once your root file system (which normally is at level 0) has been mounted, as that is probably where /media/NAS is located.

Then you might also need to remove the -3g IIRC, that was dropped from ntfs a couple of years ago after the third generation became the "standard' version.

/dev/sda1   /media/NAS      ntfs    auto,defaults   0   2
Anthon
  • 79,293
  • Hi,I tried it with changing the last 0 to 1 or 2, but no avail, I removed the -3 behind NTFS, but that didn't automount it either. I'm at work now and I think my hard drive is turned off, so I'm gonna have to try it out when I'm back at home. (thanks for the quick response) – Dutchman May 25 '15 at 14:43
  • @Dutchman I had the chance to try this out remotely on a friends Banana Pi, (running a Debian derivative, he lives 550km away and had bought a 6Tb external drive). After that I realise I did not remove the noauto, option but changed it to auto for him. Which I thought would be included in the default, but you can try to add it explicitly (as I did). If that doesn't work: Q1) does mount /media/NAS work? or do you mount differently. And Q2) what distribution are you running on your raspberry pi? – Anthon May 25 '15 at 15:53
  • OTOH defaults should include auto – Anthon May 25 '15 at 15:54
  • I couldn't get it to work using the fstab file, so I ended up writing a mount script sudo mount UUID=44C0BAFAC0BAF172 /data, and referenced to it in the /etc/rc.local file. Once rebooted I was able to access the drive immediately. Q1 I usually mount with sudo mount /dev/sdaX /folder-to-mount-in or sudo mount -a. Q2 Raspbian – Dutchman May 27 '15 at 00:49
  • @Dutchman does that mean you never tested just using mount /media/NAS? Maybe your /dev/sda1 is not that drive, or your usb module is not loaded at that point yet. You can use UUID as with UUID=44C0BAFAC0BAF172 /data ntfs defaults 0 2 in the /etc/fstab as well. – Anthon May 27 '15 at 01:31
  • I checked whether /dev/sda1 was the name of my drive with sudo fdisk -l. (by the way, /media/NAS/ became /data/ just a different mount folder). so sudo mount /dev/sda1 /data mounts the drive just fine. The problem is not that the drive doesn't want to mount, the problem is that it doesn't/didn't auto mount when I rebooted my pi. I also tried UUID=44C0BAFAC0BAF172 /data ntfs defaults 0 2 in fstab, but that doesn't automount my drive when I reboot. – Dutchman May 27 '15 at 17:40