{"id":131,"date":"2019-10-19T20:37:51","date_gmt":"2019-10-19T19:37:51","guid":{"rendered":"http:\/\/www.qpcoaching.co.uk\/qedevelopment.co.uk\/?p=131"},"modified":"2020-11-18T13:04:33","modified_gmt":"2020-11-18T13:04:33","slug":"mounting-a-usb-hard-disk-on-a-raspberry-pi","status":"publish","type":"post","link":"https:\/\/qedevelopment.co.uk\/?p=131","title":{"rendered":"Raspberry Pi: How to mount a USB hard disk"},"content":{"rendered":"\n<p>After connecting the drive to the Pi, we first need to find out where it is located. One way to do this is via the blkid command, which lists the block devices on the PI. Below is the output I get when entering this command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo blkid\n\/dev\/mmcblk0p1: LABEL=\"boot\" UUID=\"3725-1C05\" TYPE=\"vfat\" PARTUUID=\"80ea9ce7-01\"\n\/dev\/mmcblk0p2: LABEL=\"rootfs\" UUID=\"fd695ef5-f047-44bd-b159-2a78c53af20a\" TYPE=\"ext4\" PARTUUID=\"80ea9ce7-02\"\n\/dev\/mmcblk0: PTUUID=\"80ea9ce7\" PTTYPE=\"dos\"\n\/dev\/sda1: LABEL=\"Elements SE\" UUID=\"2E1C78611C78264D\" TYPE=\"ntfs\" PARTLABEL=\"Elements SE\" PARTUUID=\"0f520684-2030-4069-8d8e-45b4197ba26d\"<\/pre>\n\n\n\n<p>Having found the device you could now mount it manually with the following command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo mount \/dev\/sda1 \/mnt<\/pre>\n\n\n\n<p>I&#8217;m going to make the assumption that you want the drive to mount automatically however. To accomplish this we first need to modify the \/etc\/fstab file. To do this I&#8217;m going to use nano as shown below.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo nano \/etc\/fstab<\/pre>\n\n\n\n<p>Now enter the details for your drive. Mine is shown in the last line of the file. When you&#8217;ve finished type &lt;ctrl&gt;X to exit and save, then follow the on screen instructions. Make sure you set the location of the drive according to the location you determined above, \/dev\/sda1 in my case.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">proc                  \/proc           proc    defaults                 0       0\nPARTUUID=80ea9ce7-01  \/boot           vfat    defaults                 0       2\nPARTUUID=80ea9ce7-02  \/               ext4    defaults,noatime         0       1\n\/dev\/sda1             \/mnt            ntfs    auto,uid=1000,pid=1000   0       0<\/pre>\n\n\n\n<p>You now need to tell Linux to mount all the file system mentioned in the \/etc\/fstab file. You do this by typing the following.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo mount -a<\/pre>\n\n\n\n<p>If you now try to list the conents of the drive you may receive a message telling you that you do not have permission to open the \/mnt directory. If that is the case then you can change the directory permissions via the chmod command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo chmod 777 \/mnt<\/pre>\n\n\n\n<p>Which should allow you to finally see the contents of the disk.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ ls \/mnt\nMovies  $RECYCLE.BIN  System Volume Information  TV Shows<\/pre>\n\n\n\n<p>To gain the most use from mounting the disk you probably need to install the ntfs-3g package. This is required if you want to write as well as read the drive. You can do this with the following command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo apt-get install ntfs-3g<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>After connecting the drive to the Pi, we first need to find out where it is located. One way to do this is via the blkid command, which lists the block devices on the PI. Below is the output I get when entering this command. $ sudo blkid \/dev\/mmcblk0p1: LABEL=&#8221;boot&#8221; UUID=&#8221;3725-1C05&#8243; TYPE=&#8221;vfat&#8221; PARTUUID=&#8221;80ea9ce7-01&#8243; \/dev\/mmcblk0p2: LABEL=&#8221;rootfs&#8221; &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/qedevelopment.co.uk\/?p=131\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Raspberry Pi: How to mount a USB hard disk&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[1],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/131"}],"collection":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=131"}],"version-history":[{"count":5,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/131\/revisions"}],"predecessor-version":[{"id":315,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/131\/revisions\/315"}],"wp:attachment":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}