mount_usb_drive_on_boot
This is an old revision of the document!
Mount USB Drive on Boot
Having created a partition, formatted it and mounted it, the mounting temporary and will be lost upon reboot. To mount it at boot we can do the following:
First we need to work out the disk we wish to mount:
ls -l /dev/disk/by-uuid (on my system that is the SD card we booted from and a single USB Hard Disk) total 0 lrwxrwxrwx 1 root root 15 Jul 28 20:33 0403-0201 -> ../../mmcblk0p1 lrwxrwxrwx 1 root root 15 Jul 28 20:33 1495-189B -> ../../mmcblk0p6 lrwxrwxrwx 1 root root 15 Jul 28 20:33 200C-EA5B -> ../../mmcblk0p8 lrwxrwxrwx 1 root root 15 Jul 28 20:33 26d10fa3-fe0a-4044-b24a-9b85c2079122 -> ../../mmcblk0p9 lrwxrwxrwx 1 root root 10 Jul 28 20:33 6af40af7-759f-4ee5-afea-882e9f58f17e -> ../../sda1 lrwxrwxrwx 1 root root 15 Jul 28 20:32 705f6e2b-fac6-4f33-8611-d57a9c9f04e1 -> ../../mmcblk0p5 lrwxrwxrwx 1 root root 15 Jul 28 20:33 759bca6b-5766-4941-b830-cdbfcd861107 -> ../../mmcblk0p7 The assignment ending in /sda1 is what I am interested in.
Note Down the value of the drive you wish to mount 6af40af7-759f-4ee5-afea-882e9f58f17e (in this example)
Get the uid, gid for pi user and group using: id uid=1000(pi) gid=1000(pi) groups=1000(pi),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),101(input),108(netdev),997(gpio),998(i2c),999(spi) Here we can see the uid for pi is 1000 (I am assuming you are using the pi account)
Mount the USB Drive and then check if it is accessible at /media/NEWDRIVE
sudo mount -t ntfs-3g -o uid=1000,gid=1000,umask=007 /dev/sda1 /media/NASDRIVE
mount_usb_drive_on_boot.1469738848.txt.gz · Last modified: 2023/03/09 22:35 (external edit)