• Arun Kumar

Mount Hard Disk in Linux

In this article we will be looking at adding a new hard disk to a Linux virtual machine and mount it on a directory. This can be achieved by adding a hard disk to virtual box machine under settings and mounting it on a specific directory.


Add hard disk virtualbox

Shutdown the VM >> go to settings >> select storage and add new HDD. Give the HDD size as to how much space you want to add.


Format disk

Start the VM, and now it’s time to create a partition on the newly added hard disk

# fdisk -l

-- select the name of the newly added hard disk. look at the size

# fdisk /dev/xvdb

-- create a primary partition. enter (p)
-- hit enter
-- hit enter
-- hit enter
-- type w to save newly created partition

Format the newly created partition

mkfs.xfs <partition_name>

Mount disk

Once you have created a full partition on the new hard disk, create a directory where you will mount this disk

mkdir /u03

List the exact name of the partition suing below command

# fdisk -l /dev/xvdb

Generally the partition will always be <disk_name> + 01 for first partition. Example, in our case, the partition name is /dev/xvdb01.


Mount the partition on /u03

# mount /dev/xvdb01 /u03

Verify the mount is done

df -h
lsblk
mount -a
lsblk

Edit /etc/fstab file

We want the new hard disk to mount on /u03 even after server restart. To achieve that, we must add entry to /etc/fstab file. First thing, find the UUID of the hard disk

ls -lrt /dev/disk/by-uuid

Copy the UUID from above output for /dev/xvdb disk and add below entry to /etc/fstab file. Make sure to change the UUID as per your server details

vi /etc/fstab

UUID=2a20cd87-f89e-4c59-945f-3700d8d1e08f /u03 xfs defaults 0 0

80 views

Recent Posts

See All

Important Linux Commands

This article describes important Linux commands that you must know as a system or database administrator. Check CPU Cores in Linux Use one of the below commands to find number of CPUs in Linux includi

Manage Linux Firewall with iptables and firewalld

In this article will be covering details regarding iptables and firewalld which helps in Linux firewall management. We will also be looking at how to enable specific ports (1521 for Oracle) inside ipt

Setup Passwordless Connectivity in Linux

Every time you ssh from one Linux server to another, you need to enter target server user's password. We can also setup password less ssh login between two Linux servers so that you don't have to ente

  • Facebook
  • Twitter
  • YouTube
  • Instagram

© 2020 by DBA Genesis

Feedback