Score:0

USB harddisk gets two different mount points - why?

cn flag

Running Ubuntu 18.04.5 LTS on arm architecture (Odroid-N2+)

I have connected a USB harddisk (/dev/sda) to my computer with a 4TB ext4 partition (/dev/sa1) and have edited /etc/fstab to have /dev/sda1 mounted at startup to let's say /media/user/placeA. This works, but /dev/sda1 is also mounted to /media/usb0 (there is nothing for this in /etc/fstab) which I don't need and don't want.

There is a second USB hardisk (/dev/sdb) with a 4TB NTFS partition also included in /etc/fstab to be mounted at /media/user/placeB which works fine too, but this one does not mount to a second mount point like i.e. /media/usb1.

Does anyone know why the first USB disk mounts to /media/usb0 and how to avoid this?

  • fstab content:

    # UNCONFIGURED FSTAB FOR BASE SYSTEM
    LABEL=BOOT /media/boot vfat umask=0077 0 1
    UUID=e139ce78-9841-40fe-8823-96a304a09859 / ext4 errors=remount-ro 0 1
    UUID=2D3706383B1F1ECC /media/user/placeB ntfs-3g defaults 0
    UUID=c47f79ed-59d1-4dd3-9214-39002cd17c49 /media/user/placeA ext4 defaults 0
    
  • blkid output:

    /dev/mmcblk1p1: SEC_TYPE="msdos" LABEL="BOOT" UUID="F702-39CB" TYPE="vfat" PARTUUID="03823826-01"
    /dev/mmcblk1p2: LABEL="rootfs" UUID="e139ce78-9841-40fe-8823-96a304a09859" TYPE="ext4" PARTUUID="03823826-02"
    /dev/sda1: UUID="c47f79ed-59d1-4dd3-9214-39002cd17c49" TYPE="ext4" PARTUUID="e64182bb-4314-4bed-acde-eeb41a714b19"
    /dev/sdb1: UUID="2D3706383B1F1ECC" TYPE="ntfs" PTTYPE="dos" PARTLABEL="primary" PARTUUID="4e8bc928-364a-4e38-a073-fdd2e6e96a74"
    /dev/mmcblk1: PTUUID="03823826" PTTYPE="dos"
    
  • lsblk output:

    NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    sda           8:0    0  3,7T  0 disk
    └─sda1        8:1    0  3,7T  0 part /media/usb0
    sdb           8:16   0  3,7T  0 disk
    └─sdb1        8:17   0  3,7T  0 part /media/user/placeB
    mmcblk1     179:0    0 59,7G  0 disk
    ├─mmcblk1p1 179:1    0  128M  0 part /media/boot
    └─mmcblk1p2 179:2    0 59,6G  0 part /
    
paladin avatar
kr flag
Please do also a `blkid` and `lsblk` command and post the result too. PS you may edit your original post
Hervshahn avatar
cn flag
Done, see in original post - thanks a lot @paladin !
Score:0
kr flag

I'm not entirely sure why this error happens, but I've observed some other things. I guess, you are using a Raspberry-Pi (or some other embedded computer). I'll give you some general tips. First there are more or less 2 obvious mount directories in a Linux/Unix OS, first is /mnt and second is /media. /mnt shall only be used as a temporary mount folder by an admin. /media shall be used only for removable devices, more precisely unknown devices. This means, you should not use /media as a regular mount directory in /etc/fstab.

Now you'll ask, "But where the hell shall I mount my permanent devices, like USB-harddisks and etc.?".

The answer is, you mount them into specific directories or in general directories.

For example, mmcblk1p1 seems to be a boot partition for your Linux OS. So you should mount it into a specific directory like /boot.

Before doing so, make sure that /media/boot and /boot have the same files (name, size, date). If files in both directories are different, you may copy the newest files over the oldest files. Make sure to create a backup first, in case something bad happens.

Make a backup of your fstab file.

fstab - boot partition

# Comments start with a #-character
# LABEL=BOOT /boot vfat umask=0077 0 1
# Using UUID is generally advisable
UUID=F702-39CB /boot vfat umask=0077 0 1

"Okay, but what general directories shall I use?"

If you don't want to invent the wheel new, you may use /srv directory for permanent mounting, more precisely you may create some sub-directories there. For example: sudo mkdir /srv/sda1 /srv/sdb1. Some other admins create even a new directory in root-directory, like sudo mkdir /amnt /amnt/sda1 /amnt/sdb1 (amnt shall mean auto-mount), or sudo mkdir /automnt /automnt/sda1 /automnt/sdb1. Personally I prefer the /srv directory.

A general entry in fstab consists out of 6 parts:

<DEVICE> <MOUNT-DIR> <FS-TYPE> <FS-OPTIONS> <USE-DUMP> <DO-FS-CHECK>

As a general tip for newbies: <USE-DUMP> should be always 0. <DO-FS-CHECK> should be always 1 when <MOUNT-DIR> is / or /boot or /boot/efi. <DO-FS-CHECK> should be always 2 for all other entries when <FS-TYPE> is ext2, ext3 or ext4. For all remaining entries <DO-FS-CHECK> should be 0.

I see your partition sdb1 is NTFS. You should know that this might be dangerously, because Ubuntu doesn't really support NTFS. It might even becomes more dangerously, when you've installed Windows on that partition. Dangerously means possible total loss of all data on that partition.

If you really want to use NTFS in Ubuntu, you should make sure the following things are done.

  • deactivate Fast Startup-Mode in Windows
  • never write Data onto NTFS-filesystems from Linux
  • never do filesystem checks on NTFS from Linux
  • you should mount NTFS as read-only filesystem in Linux

fstab - with all entries (don't forget sudo mkdir /srv/sda1 /srv/sdb1 and using newest boot files)

# Comments start with a #-character
# LABEL=BOOT /boot vfat umask=0077 0 1
# Using UUID is generally advisable
UUID=F702-39CB /boot vfat umask=0077 0 1
UUID=e139ce78-9841-40fe-8823-96a304a09859 / ext4 errors=remount-ro 0 1
UUID=c47f79ed-59d1-4dd3-9214-39002cd17c49 /srv/sda1 ext4 defaults 0 2
UUID=2D3706383B1F1ECC /srv/sdb1 ntfs-3g ro 0 0

Try to apply these settings, when possible. Make a backup of your fstab file.

Hervshahn avatar
cn flag
Thank you very much paladin, these are really helpful tips for a newbie like me! Yes you are right, I'm using a Odroid-N2+ computer with Ubuntu Linux. I will make the advised changes and see if all works - thanks again !!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.