NervExl
Posts: 5
Joined: Fri Feb 22, 2013 6:56 pm

USB HDD not auto mounting

Fri Mar 15, 2013 8:29 pm

Hey all,

I bought a 3 TB external hdd with external power supply.
The drive is formatted in 2 partitions with ext4.
ive got sdb5 and sdb6, sdb6 mount every time the pi starts up, even though i havent put it in to /etc/fstab.
The problem i have is that sdb5 will not mount, not even if i add it to /etc/fstab

/dev/sdb5 /mnt/downloads auto defaults,uid=107,gid=112 0 0

i have transmission-daemon running in the background, and it would be nice to have the MediaCenter harddrive automounted. Every time i boot up my pi i have to type mount /dev/sdb5 /mnt/downloads, even though /etc/fstab should handle it.

Do you have any thoughts?

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5804
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: USB HDD not auto mounting

Fri Mar 15, 2013 10:03 pm

I think that your /etc/fstab entry may not be quite right: FWIW examples of (my approach) to auto-mounting (in my case USB flash drives) can be seen at http://www.cpmspectrepi.webspace.virgin ... ticks.html . It also contains links to other info. in the wiki.
HIH, Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

NervExl
Posts: 5
Joined: Fri Feb 22, 2013 6:56 pm

Re: USB HDD not auto mounting

Sun Mar 17, 2013 11:49 am

FTrevorGowen wrote:I think that your /etc/fstab entry may not be quite right: FWIW examples of (my approach) to auto-mounting (in my case USB flash drives) can be seen at http://www.cpmspectrepi.webspace.virgin ... ticks.html . It also contains links to other info. in the wiki.
HIH, Trev.
Hey,
I tried to look at the link you posted, and tried another entry with UUID identification. My problem are not solved, i still manually have to mount the drive, even though the fstab seems to contain the right string. I must say that im quite a noob at linux, even though ive read a lot about it since i got my pi.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5804
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: USB HDD not auto mounting

Sun Mar 17, 2013 6:56 pm

NervExl, On re-reading your original post I think I've now spotted what was "not quite right":
NervExl wrote: ...
The drive is formatted in 2 partitions with ext4.
ive got sdb5 and sdb6, sdb6 mount every time the pi starts up, even though i havent put it in to /etc/fstab.
...
If the drive just contained two ext4 (primary) partitions IIRC I'd expect them to be sdb1 and sdb2 (sdb being the "drive"). Did you partition and format the drive yourself? If so, with what tool? I normally use GParted within Ubuntu linux. This is probably the GUI version of "parted". According to its man pages, the older "fdisk" program is NOT recommended for "large partitions" which your 3 TB drive would need. What does "sudo parted -l" report? cf. that below for my first Pi (Model B1, 256Mb) with 16Gb USB stick.

Code: Select all

pi@raspiblack ~ $ sudo parted -l
Model: Kingston DT Micro (scsi)
Disk /dev/sda: 15.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number  Start   End     Size    Type     File system  Flags
 1      1049kB  15.7GB  15.7GB  primary  fat32
Model: SD SA04G (sd/mmc)
Disk /dev/mmcblk0: 3905MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number  Start   End     Size    Type     File system  Flags
 1      4194kB  62.9MB  58.7MB  primary  fat16        lba
 2      62.9MB  3905MB  3842MB  primary  ext4
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

NervExl
Posts: 5
Joined: Fri Feb 22, 2013 6:56 pm

Re: USB HDD not auto mounting

Mon Mar 18, 2013 9:48 am

Hi Trev,

using the command "sudo parted -l" give me this:

Code: Select all

root@raspbmc:~# parted -l
-bash: parted: command not found
root@raspbmc:~# sudo parted -l
sudo: parted: command not found
root@raspbmc:~# fdisk -l
If i use fdisk -l ill get this:

Code: Select all

root@raspbmc:~# fdisk -l

Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 32 sectors/track, 121280 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002c475

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            4096      147455       71680    c  W95 FAT32 (LBA)

Disk /dev/sda: 8004 MB, 8004304896 bytes
35 heads, 21 sectors/track, 21269 cylinders, total 15633408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00085d01

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1    15633407     7816703+  83  Linux
Note: sector size is 4096 (not 512)

Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 45600 cylinders, total 732566646 sectors
Units = sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x8ee9f2ab

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1             193   732563967  2930255100    f  W95 Ext'd (LBA)
/dev/sdb5             256   728722943  2914890752   83  Linux
/dev/sdb6       728723200   732563967    15363072   83  Linux
I have made the partitions from my windows 8 laptop with the program
Minitool partition Wizard Home Edition
http://www.partitionwizard.com/free-par ... nager.html

NervExl

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5804
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: USB HDD not auto mounting

Mon Mar 18, 2013 5:22 pm

NervExl wrote:Hi Trev,
...
If i use fdisk -l ill get this:

Code: Select all

root@raspbmc:~# fdisk -l

Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 32 sectors/track, 121280 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002c475

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            4096      147455       71680    c  W95 FAT32 (LBA)

Disk /dev/sda: 8004 MB, 8004304896 bytes
35 heads, 21 sectors/track, 21269 cylinders, total 15633408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00085d01

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1    15633407     7816703+  83  Linux
Note: sector size is 4096 (not 512)

Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 45600 cylinders, total 732566646 sectors
Units = sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x8ee9f2ab

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1             193   732563967  2930255100    f  W95 Ext'd (LBA)
/dev/sdb5             256   728722943  2914890752   83  Linux
/dev/sdb6       728723200   732563967    15363072   83  Linux
...
Now I understand why you've got sb5 and sb6 - None of your partitions are "primary" ones. I'm not certain, but it's possible that the auto-boot process expects at least one primary partition on a disk. For example see the layouts below for my dual-boot netbook with a Seagate 1Tb USB drive also attached:

Code: Select all

trevor@BlueElf:~$ sudo parted -l
[sudo] password for trevor: 
Model: ATA WDC WD1600BEVT-2 (scsi)
Disk /dev/sda: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system     Flags
 1      32.3kB  7518MB  7518MB  primary   ntfs            diag
 2      7518MB  76.2GB  68.7GB  primary   ntfs            boot
 3      76.2GB  160GB   83.8GB  extended
 5      76.2GB  84.8GB  8579MB  logical   ntfs
 6      84.8GB  93.4GB  8587MB  logical   fat32
 7      93.4GB  157GB   63.9GB  logical   ext4
 8      157GB   160GB   2764MB  logical   linux-swap(v1)

Model: Seagate Expansion (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  1000GB  1000GB  primary  ntfs
Note that both drives have at least one primary partition. A single drive can have upto 4 primary partitions. However, if more than four partitions are needed one (or more) of these may become an extended partition which then becomes a "container" for a number of logical partitions. IIRC each extended partition can contain upto 4 logical partitions too. Since you only need two partitions the only reason I can think of why they are not both primary's is that your partitioning tool can only create the very large partitions you needed as logical ones. I'm not familiar with the tool you've used. In the past I've used various versions of "Partition Magic" on Windows m/cs but for some years now I've tended to use Gparted, booting up a "live distro" such as Knoppix Linux from CD or USB stick if necessary. That's how I was able to safely resize the original Windows (ntfs) partitions on my netbook to make room for and enable "dual-booting" into Ubuntu Linux.
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

NervExl
Posts: 5
Joined: Fri Feb 22, 2013 6:56 pm

Re: USB HDD not auto mounting

Tue Mar 19, 2013 12:18 pm

Hi Trev,

i made both partitions primary now, but it seems that when i edit fstab the drive is not mounted. if i dont add the harddrive to fstab it will mount, but not at my specified folder /mnt/downloads

Code: Select all

Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 32 sectors/track, 121280 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002c475

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            4096      147455       71680    c  W95 FAT32 (LBA)

Disk /dev/sda: 8004 MB, 8004304896 bytes
35 heads, 21 sectors/track, 21269 cylinders, total 15633408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00085d01

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1    15633407     7816703+  83  Linux
Note: sector size is 4096 (not 512)

Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 45600 cylinders, total 732566646 sectors
Units = sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x8ee9f2ab

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1             256   728722943  2914890752   83  Linux
/dev/sdb2       728723200   732563967    15363072   83  Linux
i really cant figure out what im doing wrong ive tried theese to entrys in fstab after i made i primary

/dev/sdb1 /mnt/downloads auto defaults,uid=107,gid=112 0 0

and

/dev/sdb1 /mnt/downloads ext4 defaults,uid=107,gid=112 0 0

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5804
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: USB HDD not auto mounting

Tue Mar 19, 2013 10:20 pm

NervExl wrote: ...
i made both partitions primary now, but it seems that when i edit fstab the drive is not mounted. if i dont add the harddrive to fstab it will mount, but not at my specified folder /mnt/downloads
...
Hmm... The normal mount point for an external drive is "/media/drive_partition_name" where "drive_partition_name" is unique for each partition. When a USB drive is not auto-mounted to a named sub-directory of "/media" (via an fstab entry) GUI-based file managers (on the "desktop") sometimes mount said drive to a sub-directory named by the drives UUID or, for Windows formats (esp. FAT32) the (Windows) drive label entry (ie. the "old" fstab way). NB: each partition must be mounted to a different sub-directory! I suspect that if you have two auto-mount points within fstab using the same directory name only one of them will be mounted there (which one? - it may depend on entry order or drive spin up time ...). It's possible that manual mount entries in fstab may point to the same mount point but only one physical device may be mounted to that point at any one time eg. you might be able to mount either an internal or external CD drive (read only) perhaps. However it's good practice to use unique mount points (or, even, sometimes just let the system mount removable media where it wants to "by default").
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

NervExl
Posts: 5
Joined: Fri Feb 22, 2013 6:56 pm

Re: USB HDD not auto mounting

Tue Mar 26, 2013 2:14 pm

Hi Trev,

After pulling my hair out of my head, i tried reinstalling RaspBMC from scratch with an sd-card booting, and USB-pen running Rasp.

My Fdisk -l is now

Code: Select all

Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 32 sectors/track, 121280 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002c475

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            4096      147455       71680    c  W95 FAT32 (LBA)

Disk /dev/sda: 8004 MB, 8004304896 bytes
35 heads, 21 sectors/track, 21269 cylinders, total 15633408 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0008704c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1    15633407     7816703+  83  Linux
Note: sector size is 4096 (not 512)

Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 45600 cylinders, total 732566646 sectors
Units = sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x8ee9f2ab

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1             256   728722943  2914890752   83  Linux
/dev/sdb2       728723200   732563967    15363072   83  Linux
i now edited fy fstab to this

Code: Select all

proc            /proc           proc    defaults         0       0
devpts          /dev/pts        devpts  rw,nosuid,noexec,relatime,gid=5,mode=620        0       0
/dev/mmcblk0p1  /boot           vfat    defaults,noatime         0       0
/dev/sda1       /               ext4    defaults,noatime 0       0
/dev/sdb1       /mnt/downloads  auto    defaults,uid=107,gid=112  0       0
i only have sdb1 mounted at /mnt/downloads. I have no problem mounting it manually, but this is something i have to do, every time my pi restarts.

Cant really seem to find a solution

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: USB HDD not auto mounting

Mon Aug 05, 2013 4:14 pm

I am wondering why you mount at /mnt

I like you was and still am a nooby and reading some web pages, I also mounted at /mnt until I realised that the new distro of Raspbian automatically mounts the attached drives to /media.

Like you I tore my hair out until that point and I also loaded a new Raspbian and started again. This time I did not tell the system where to mount the drives (2 x 1Tb) and they were mounted automatically and seen via the system.

All I had to do then was to create a folder for sharing and I chose /media/HDD1/ and /media/HDD2/

I then created shares in each of those folders. Every thing works fine. My fstab's are:

/dev/sda1 /media/HDD1 auto noatime 0 0
/dev/sda2 /media/HDD2 auto noatime 0 0

I hope that helps.

I only notice one problem having setup Task Scheduler to run automatic backups with AllwaySync and cron jobs to copy updates across to the second drive - two times now I have 'lost' HDD1 and AllwaySync reports an 'access denied' error.

When I check via file manager, there is in fact only one drive, HDD2 shown. A reboot is necessary to bring the drive back. Whether that is due to a hardware or software problem I have not yet found. Maybe somebody reading will have had a similar problem.

It is similar to losing a HD in Windows.

itimpi
Posts: 1090
Joined: Sun Sep 25, 2011 11:44 am
Location: Potters Bar, United Kingdom
Contact: Website

Re: USB HDD not auto mounting

Mon Aug 05, 2013 4:20 pm

Under Linux you can mount devices anywhere.

By tradition it seems that /mnt is typically used for drives that are always there and /media tends to be used for removable devices. However this is only a convention and no rule that says it has to be done that way.

User avatar
makem2
Posts: 233
Joined: Tue Jul 02, 2013 9:12 am
Location: Essex
Contact: Website

Re: USB HDD not auto mounting

Mon Aug 05, 2013 11:16 pm

Perhaps Raspbian bucks the tradition as it uses /media or so it did in my instance with fixed drives.

Yes, I agree, in many hair pulling sessions web pages advised various places to mount to. However, I did find that some appeared very old information.

itimpi
Posts: 1090
Joined: Sun Sep 25, 2011 11:44 am
Location: Potters Bar, United Kingdom
Contact: Website

Re: USB HDD not auto mounting

Tue Aug 06, 2013 7:51 am

makem2 wrote:Perhaps Raspbian bucks the tradition as it uses /media or so it did in my instance with fixed drives
On Raspbian your drive will be connected via USB which is always considered removable. Fixed drives would be connected via IDE or SATA which the Pi does to support

Return to “Troubleshooting”