close
» » Mounting a new hard disk or disk partition

Mounting a new hard disk or disk partition

System

Mounting a new hard disk or disk partition

Sometimes when you connect the second hard disk after reboot it is not automatically mounted, have to do it manually every time you turn on your computer.

 

A few simple steps will allow You to do automatic mounting of a hard disk or partition at boot.

First look at the IDs of the connected partitions, run this command:

sudo blkid

 

 

Approximate output:

/dev/sda1: UUID="1c1ed346-9d43-45ed-a8ae-99a1ae89778c" TYPE="ext4" 
/dev/sda5: UUID="634f0a17-b981-49a9-972f-5e56629831e5" TYPE="swap" 
/dev/sdb1: UUID="82b40ac2-265b-40d8-96c5-60a47478e0fa" TYPE="ext4" 
/dev/sdb5: UUID="f8b1807c-bb57-4be2-92e9-ebd0235597d7" TYPE="ext4"

In my example it is seen that the main drive (system) is sda, I need to mount a second hard drive sdb.
Settings partition /dev/sdb: UUID="10d4bbc7-fd2a-4aec-a263-7f31c97d85cb" , type ext4 file system, all these parameters will be used to automatically mount the disk.

A universally unique identifier (UUID) is an identifier standard used in software construction. A UUID is simply a 128-bit value. The meaning of each bit is defined by any of several variants.
For human-readable display, many systems use a canonical format using hexadecimal text with inserted hyphen characters. For example:
de305d54-75b4-431b-adb2-eb6b9e546014

 

Before you mount the drive you need to create a mount point (folder), create a mount point will be in the media folder (you can create this folder anywhere, for example in your home directory)

sudo mkdir /media/otherdisk

,otherdisk is the mount point, You can choose any other name.

In Linux Mint (Ubuntu, ElementaryOS, Deepin, etc) there is a special /etc/fstab file, which stores settings mount the various partitions, including the root and swap, open it for editing:

sudo gedit /etc/fstab

your distribution may be a different text editor. Universal nano editor that can open text files directly in the terminal.

Mounting a new hard disk or disk partitionMounting a new hard disk or disk partition

Add in this file entry with the parameters we need

UUID=82b40ac2-265b-40d8-96c5-60a47478e0fa /media/otherdisk ext4 defaults 0 3

Mounting a new hard disk or disk partitionMounting a new hard disk or disk partition

With UUID everything is clear, we simply copied the disk ID, then specifies the path to the mount point is /media/otherdisk and the file system type is ext4. The defaults parameter consists of two numbers, the first number is 0 means it is disabled backup file system, the second number 3 means the procedure of checking the file system when the computer starts.
Save the file.

Next, mount the drive "sudo mount -a" or just restart your computer. Upon reboot, the disk will be automatically mounted.

Mounting a new hard disk or disk partition

Good Luck!!!

Print version

Add comments

  • Local comments
  • Facebook comments
soloID
soloID 24 April 2015 14:49
Good stuff but using the disks utility is much easier!
  • 0
Saeid Sakkaki
Saeid Sakkaki 4 April 2017 03:33
Hi there, I tested this way but didn't see any change!
My partition UUID is "C232346B32346697" and is "NTFS" instead of ext4 or others...
And when I looked, my "fstab" file was not same as your file (as shown in this picture).
Please help me.
I'm a Linux Mint 17.2 user :|

Saeid Sakkaki,
this is my terminall final output...
mint@mint ~ $ sudo mount -a
Failed to read last sector (123369471): Invalid argument
HINTS: Either the volume is a RAID/LDM but it wasn't setup yet,
or it was not setup correctly (e.g. by not using mdadm --build ...),
or a wrong device is tried to be mounted,
or the partition table is corrupt (partition is smaller than NTFS),
or the NTFS boot sector is corrupt (NTFS size is not valid).
Failed to mount '/dev/sda3': Invalid argument
The device '/dev/sda3' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
mint@mint ~ $
  • 0
  • bowtiesmilelaughingblushsmileyrelaxedsmirk
    heart_eyeskissing_heartkissing_closed_eyesflushedrelievedsatisfiedgrin
    winkstuck_out_tongue_winking_eyestuck_out_tongue_closed_eyesgrinningkissingstuck_out_tonguesleeping
    worriedfrowninganguishedopen_mouthgrimacingconfusedhushed
    expressionlessunamusedsweat_smilesweatdisappointed_relievedwearypensive
    disappointedconfoundedfearfulcold_sweatperseverecrysob
    joyastonishedscreamtired_faceangryragetriumph
    sleepyyummasksunglassesdizzy_faceimpsmiling_imp
    neutral_faceno_mouthinnocent
Your working environment Other polls