0

I want to mount an external hard drive into my raspberry pi, I want to do it in a way that get fixed to the same drive, so it is always in the same path, that's why I am editing /etc/fstab.

I though it was working, but it doesn't

I executed the following steps

  • Format the external hard drive
$ sudo mkfs -t ext4 /dev/sda
  • Create a folder where I will mount the external hard drive
$ sudo mkdir /media/edrive
  • Give Permissions to the folder
$ sudo chown -R $(id -u):$(id -u) /media/edrive
  • Get the external disk UUID
$  sudo blkid
  • Edit /etc/fstab
...
UUID="1854-71A3"  /media/edrive ext4   defaults,nofail 0       1
...

Everything seems to work, but when I check the added data is on the micro sd, and not in the external drive.

How can I check if the disk is mounted? Is there an step I am missing?

4
  • 1
    You can use "mount -a" command which will mount all the drives in /etc/fstab that arent't currently mounted. But be careful - if the drive isn't attached to the raspberry when you boot, the boot may crash - consider adding "auto" to the mount options. And I'd recomment removing "nofail" which imples if there is something wrong with the drive, the boot will crash. To umount the drive, type "umount /dev/sda". To see if it's mounted, type "mount | grep /dev/sda" - or look in /etc/mtab. – Cinaed Simson Apr 26 at 3:36
  • @CinaedSimson thanks for your answer. I tried editing the /etc/fstab as you suggested I removed the nofail and added the auto. After that change I was not able to boot the raspberry. No worries, I have this raspberry for playing and learning. – agusgambina Apr 26 at 13:02
  • 1
    I didn't realize you were booting off the drive - the path /media suggested you were using it as a data drive, If you're booting off the drive then what you did was correct. If you're not booting of the device, you can have a fixed path using "auto" to mount under /media/<userid> provided you label the drive when you format it.using the "-L volume-name" option. Also, if you have another computer, you can always recover from /etc/fstab problems by mounting it on anotehr computer and editing it. – Cinaed Simson Apr 27 at 4:33
  • @CinaedSimson thanks, with your first comment I was able to solve the issue. I think that the problem was the mounting point I was using, as you state in the second comment. Now it is working, thanks! If you write the answer I will mark as the right answer – agusgambina Apr 27 at 14:39

Your Answer

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

Browse other questions tagged or ask your own question.