Saturday, October 31, 2015

Add New Virtual (or) Physical Hard Disk on Linux System

Add New Virtual (or) Physical Hard Disk on Linux System


Add New Hard Disk or New VMware Disk  (or) Virtual Hard Disk into Linux Physical / Virtual System.

Step: 1

Login into root privilege account on Linux system and perform below commands.

Find Out the scsi host adapter.

root#ls /sys/class/scsi_host
host0  host1  host2

Step: 2

Command configures devices and installs device into the linux system.

root#echo "- - -" > /sys/class/scsi_host/host0/scan
root#echo "- - -" > /sys/class/scsi_host/host1/scan
root#echo "- - -" > /sys/class/scsi_host/host2/scan

Step: 3

Check the added new disk logs.

root#tail -f /var/log/messages

Step: 4

Display the Added New Disk.

root#fdisk -l

Disk /dev/sdb: 100 GB, 100000000000 bytes
255 heads, 63 sectors/track, 15665 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Step: 5

Convert physical disk to physical volume.

root#pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created

Step: 6

Display the physical volume.

root#pvscan
   PV /dev/sdb                   lvm2 [100.00 GB]
  Total: 2 [149.87 GB] / in use: 1 [49.88 GB] / in no VG: 1 [100.00 GB]

Step: 7

New Volume Group Creation and Adding New physical volume into New VG.

root#vgcreate data_vg /dev/sdb
Volume group "data_vg" successfully created

Step: 8

New Logical Volume creation (LV).

root#lvcreate -n long_lv -L25G /dev/data_vg
Logical volume "backup_lv" created

Step: 9

Display the Logical Volume (LV).

root#lvdisplay
/dev/data_vg/long_lv


Step: 10

Creating file system.

root#mkfs.ext3 -m 0 /dev/data_vg/long_lv
file system "/dev/data_vg/long_lv" successfully created

Step: 9

Add entry on /etc/fstab for auto mount file system after restart linux system.

root#cd /
root#mkdir logs
root#vi /etc/fstab
/dev/data_vg/long_lv /logs ext3 defaults 0 0

Step: 10

Manual Mount file system.

root#mount /logs

Step : 11

Display New file system.

root#df -h /logs

Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/data_vg-long_lv
                       25G  173M   25G   1% /logs



No comments:

Post a Comment

Gitlab Automation Project Showcase

My GitLab Projects Showcase 🚀 Welcome to my portfolio of GitLab projects. Each repository reflects my journey as an engineer, focusing...