CentOS – RHEL | Mount Hard Disk one or More Hard Drive

Most Important Commands Mount New Drive | Quick On Commands

for List -> lsblk -f

hard’s detail-> blkid

Selected hard detail ->> fdisk /dev/sda

if need format drive -> mkfs -t ext4 /dev/sdb

Make Directory(new folder on Machine)-> mkdir /www/wwwroot/data

Mount Drive -> mount /dev/sda /www/wwwroot/data
if you want unmount -> umount /dev/sda /www/wwwroot/data

Read Write Permissions If need
sudo chmod ugo+wx /www/wwwroot/data

if You want to Mount Permanent Follow this command

sudo nano /etc/fstab

add your hard disk detail here

UUID=49e61493-6b0b-49c6-ab05-b5ae8a99e79b /www/wwwroot/data ext4 defaults 0 0
What is your UUID??? Find with -> blkid

Control+x <— to save you are in nano editor of Linux
y <— then press y to save say yes,
Press Enter <— to same this directory.

Check your Mount Drives -> df -H

Great your Doing all this Good :-).


To start storing data on a block device (e.g. a partition, logical volume, or entire storage device) you first need to install a filesystem on the block device. After that you then need to mount the filesystem. Mounting a filesystem is simply the act of associating a directory (aka a mount point) to a filesystem. Any files/folders that are then put inside this mountpoint folder will actually end up getting stored on the underlying block device that’s hosting the filesystem. You can view which filesystems are attached to which mountpoint using lsblk:

lsblk -f

Step 1:
It is needed to verify whether the new drive is visible in the system. Using fdisk command, it can be identified.
fdisk -l
It will list all drives available in the system including mounted and unmounted drives. Here assume a new drive label is /dev/ssd

Step 2:
It is needed to create the file system ext4(in shortly say as formatting drive). So make sure drive is fresh/empty one. It a drive has already data, don’t enter this step, instead skip to next step. The following command helps to create file system
mkfs -t ext4 /dev/ssd

Step 3:
Now create a new directory in the root(or in desired path) to mount a formatted drive using mkdir command
mkdir mntssd

Step 4:
To mount the formatted drive with newly created directory, use the mount command
mount /dev/ssd mntssd
Now drive is available for use under mntssd directory

Step 5:
Actually mounted drive will not be available once rebooted. To avoid this loss, it is needed to set mounted drive details on fstab config file. The following commands will help to setup the settings
1. cp /etc/fstab /etc/fstab.orig  (**backup the config file before change to avoid loss of original settings if any)
2.nano /etc/fstab
3. Add this line at the end: /dev/ssd    /mntssd        ext4    defaults    0 0
4. Save the file and exit the editor
5. Use “mount -a” command to verify the fstab settings added correctly. If any error, correct the fstab settings according to the error generated

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?