1

I have a second internal hard drive, which shows up on the computer:/// page as a long string of numbers and letters (which is always the same). When I open it its gets mounted as a random (new) location, like /media/max/7830FA191926581F. It's got some stuff on it already which I can access fine, and want to keep.

I can see with df -h that it's on `/dev/sdb2/:

/dev/sdb2       525G  177G  348G  34% /media/max/7830FA191926581F 

How do I set it up so that it's a permanent location, eg as /mnt/drive2 ?

Max Williams
  • 217
  • 1
  • 3
  • 11

1 Answers1

3

A partition on an internal medium that is not automatically mounted through the system configuration file /etc/fstab is only mounted "on demand", i.e., by clicking its icon in your file manager.

A partition on an external removable medium (USB drive), in contrast, is automatically mounted when the medium is detected. Such volumes are mounted under /media/$USER/, where $USER stands for the current user, and is the volume label if it exists, or the UUID. Any volumes mounted under /mount/$USER or under your home folder will show up as an icon in the left of your file manager (and as an icon on the desktop if you use desktop icons).

To have your second internal hard drive automatically and consistently mounted during startup in a folder of your choice, you can add the mount instructions to the system file /etc/fstab. Part of the accepted answer in this post shows you how this is done. You need to adapt to your case.

  1. The line in etc/fstab that defines how your drive is mounted, is structured in six parts separated by space.1 an identifier of the partition, 2 the mount point, i.e., the folder where the partition is to be mounted, 3 the file system, 4 the options, 5 a flag for "dump" (leave on 0) and 6 a flag to check (for linux file systems such as ext2, ext 3 and ext4, or btrfs, set to 2 so the drive is checked each time on startup in second priority, i.e. after system partitions have been checked. Otherwise, leave on 0 and have the partition checked manually now and then).
  2. Start from the sudo mkdir -p /media/datadrive command. This shows how an existing partition is included in /etc/fstab. You decide yourself on where to mount. Mounting under /media will give you an extra icon. If you do not want this, mount elsewhere (e.g. as you suggest yourself, /mnt/drive2). This mount point will be entry 2 on the line for your drive in /etc/fstab file
  3. The blkid command will show you the specific information you will need. You can literaly copy the "UUID="..." part to be part 1 on the line for your drive in /etc/fstab file. Take note of the file system (ext4 in the example), which you need to substitute as part 3.
vanadium
  • 82,909
  • 6
  • 116
  • 186
  • Thanks - I put this in `/etc/fstab` and it works fine. `UUID= /mnt/drive2 ntfs default 0 0`, where the id is the one shown with `lsblk --fs`. Do you think I need to set the last flag to 2? When you say it means the drive is checked, do you mean "checked for errors"? – Max Williams Apr 02 '19 at 08:41
  • Indeed, for an ntfs drive, this should be set to 0 - you should check and repair an ntfs drive from within Windows - I will update my answer for this. – vanadium Apr 02 '19 at 08:51
  • I'm actually using Linux (mint) not Windows. – Max Williams Apr 02 '19 at 15:39
  • Excellent, but if you are using (only) Linux, you should not be using an ntfs formatted drive as an internal drive, but a file system that is fully supported by linux, ntfs should only be used in a dual boot system, where periodically one can check the volume with the Windows tools. – vanadium Apr 02 '19 at 16:10