0

I've connected my hard drive by usb but the contents do not appear in /media.

When I mount it manually using mount /dev/sdb1 /media/user it succeeds.

When I list the contents of the fstab this is what I get:

#cat /etc/fstab
# /etc/fstab: static file system information.

<file system> <mount point> <type> <options> <dump> <pass>

/ was on /dev/sda2 during installation

UUID=number / ext4 errors=remount-ro 0 1

/boot/efi was on /dev/sda1 during installation

UUID=number /boot/efi vfat umask=0077 0 1 /swapfile none swap sw 0 0

I am not sure if the device should appear there, also running lsblk, I see it (sdb1):

$ lsblk -f
sdc
└─sdc1 ntfs     username id

Why it is not mounting automatically?

EDIT: included a better description of the problem.

  • 2
    When you say you have mounted it but the contents don't appear, what do you mean exactly? How have you mounted it? There is no mention of /media in your fstab file, so this drive won't be mounted automatically. – terdon Jan 18 '22 at 20:29
  • What is the difference between "I've mounted by hard drive" and "When I mount it manually"? How did you mount "by" hard drive? Do you use a command (if so what)? Do you use an app, like Gnome Disk? How is the drive formatted, ext4, NTFS, or something else? – user68186 Jan 18 '22 at 21:00
  • If internal drive you want to add an entry to fstab. You have to create mount point, edit fstab and give yourself ownership & permissions if Linux format. If NTFS, it only uses default from parameters in fstab mount. An example: https://askubuntu.com/questions/1013677/storing-data-on-second-hdd-mounting/1013700#1013700 If external drive you need extra parameters & if NTFS additional parameters suggested. – oldfred Jan 18 '22 at 21:16
  • @terdon thanks. I run sudo mount /dev/sdb1 /media/username, and that is what I mean by manually mounting the external hard drive. –  Jan 19 '22 at 12:15
  • @user68186 that was very vague but I didn't even noticed it. Updated. –  Jan 19 '22 at 12:16
  • When you connect the drive, does an icon for it appear on your desktop or in your file manager? If this is a USB drive (which kind of changes everything and wasn't mentioned originally), then it won't be mounted at /media but somewhere under /run/media/. So, do you see an icon on the desktop? – terdon Jan 19 '22 at 12:25
  • @terdon But it was normally (in a fresh installation) mounted in /media/user –  Jan 19 '22 at 15:53

1 Answers1

0

You have to create a new entry in the /etc/fstab file.

  1. with this command:
sudo  blkid

you get important information which UUID-number your /dev/sdb1 drive have. Save the number in a text-file.

  1. Create the directory for the target path, where you want to mount your new drive. As an example you can chose a folder with the name "mydata" in your home directory. Maybe: "/home/minsky/mydata "

There you can save all your personal data and they are separated from the operating system HDD and the OS-partition.

  1. Then you can create the new mountpoint in your fstab file.

Open the /etc/fstab file with:

sudo mousepad /etc/fstab

and create a new line where you can put in a line like this:

# My 1TByte SSD or HDD
UUID=50eebbff-8f43-4a11-8877-8abb2233246     /home/minsky/mydata    ext4    defaults,noatime,nodiratime,discard,nobh,data=ordered,commit=120          0       2

Replace the UUID number in this example with the number from your research.

Now your fstab would looks like this:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda2 during installation
UUID=number /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=number  /boot/efi       vfat    umask=0077      0       1
#
# My 1TByte SSD or HDD
UUID=50eebbff-8f43-4a11-8877-8abb2233246     /home/minsky/mydata    ext4    defaults,noatime,nodiratime,discard,nobh,data=ordered,commit=120          0       2
#
/swapfile                                 none            swap    sw              0       0

Note:

You can see the type of the filesystem with:

df -T

If your drive is an SSD (or M.2 - SSD) and formated with f2fs (the flash friendly filesystem), then your mount entry in fstab should looks like this:

# My 1TByte SSD
UUID=50eebbff-8f43-4a11-8877-8abb2233246     /home/minsky/mydata    f2fs      rw,noatime,nodiratime,nosuid,nodev,discard,background_gc=off,inline_xattr,active_logs=2   0    0

If it is an NTFS-filesystem it looks like this:

UUID=077BBEE22CCA2110       /home/minsky/mydata     ntfs  rw,user,noauto,uid=0,gid=46,umask=007,nls=utf8                  0   0

(replace the example-UUID with the UUID of the f2fs or NTFS-partition)

  • will accept once i can fully test if it works fine. +1 –  Jan 19 '22 at 12:23
  • You have to mount your new Harddrive and then check which filesystem does it have! With the command: df -T , you can see the type of filesystem of your new drive. If it is a ntfs filesystem, then the mount-entry in fstab is different. – MikroPower Jan 19 '22 at 17:53
  • thanks, but it is written in the post –  Jan 19 '22 at 18:18
  • 1
    Okay, I have updated the answer for you. – MikroPower Jan 19 '22 at 21:13