adding new hard disk to linux VM :-
-----------------------------------
1. Add new HDD via VM settings.
2. power on VM.
3. run following command as root user.
# echo "- - -" | sudo tee /sys/class/scsi_host/host*/scan >/dev/null
# lsblk <-|(i.e. press Enter )
this will show you newlly added HDDs. But right now you can not use directely.
First you have to create filesystem in it and make filesystem of "xfs". Then only you can
get it in your OS. So do these :-
for example these are mine output :-
------------------------------------------------
[root@ora12cserver oracle]# echo "- - -" | sudo tee /sys/class/scsi_host/host*/scan >/dev/null
[root@ora12cserver oracle]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1000M 0 part /boot
├─sda2 8:2 0 20G 0 part /oraGridDisk1
├─sda3 8:3 0 20G 0 part /oraGridDisk2
├─sda4 8:4 0 1K 0 part
├─sda5 8:5 0 16G 0 part [SWAP]
├─sda6 8:6 0 15G 0 part /oraGridDisk3
└─sda7 8:7 0 28G 0 part /
sdb 8:16 0 20G 0 disk
sdc 8:32 0 20G 0 disk
sr0 11:0 1 4.1G 0 rom /run/media/oracle/OL-7.5 Server.x86_64
------------------------------------------------
Now to create new partition fire these commands :-
# fdisk /dv/sdb
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039
Partition 1 of type Linux and of size 20 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@ora12cserver oracle]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1000M 0 part /boot
├─sda2 8:2 0 20G 0 part /oraGridDisk1
├─sda3 8:3 0 20G 0 part /oraGridDisk2
├─sda4 8:4 0 1K 0 part
├─sda5 8:5 0 16G 0 part [SWAP]
├─sda6 8:6 0 15G 0 part /oraGridDisk3
└─sda7 8:7 0 28G 0 part /
sdb 8:16 0 20G 0 disk
└─sdb1 8:17 0 20G 0 part
sdc 8:32 0 20G 0 disk
sr0 11:0 1 4.1G 0 rom /run/media/oracle/OL-7.5 Server.x86_64
then :-
[root@ora12cserver oracle]# mkfs.xfs /dev/sdb1
now
[root@ora12cserver oracle]# fdisk /dev/sdc
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x0d073c9d.
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039
Partition 1 of type Linux and of size 20 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@ora12cserver oracle]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1000M 0 part /boot
├─sda2 8:2 0 20G 0 part /oraGridDisk1
├─sda3 8:3 0 20G 0 part /oraGridDisk2
├─sda4 8:4 0 1K 0 part
├─sda5 8:5 0 16G 0 part [SWAP]
├─sda6 8:6 0 15G 0 part /oraGridDisk3
└─sda7 8:7 0 28G 0 part /
sdb 8:16 0 20G 0 disk
└─sdb1 8:17 0 20G 0 part
sdc 8:32 0 20G 0 disk
└─sdc1 8:33 0 20G 0 part
sr0 11:0 1 4.1G 0 rom /run/media/oracle/OL-7.5 Server.x86_64
[root@ora12cserver oracle]# mount /dev/sdb1 /mnt/sdb1
[root@ora12cserver oracle]# mkfs.xfs /dev/sdc1
meta-data=/dev/sdc1 isize=256 agcount=4, agsize=1310656 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0, sparse=0
data = bsize=4096 blocks=5242624, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@ora12cserver oracle]# mount /dev/sdc1 /mnt/sdc1
[root@ora12cserver oracle]#
Tuesday, April 21, 2026
Adding new harddisk into VM Linux
Subscribe to:
Comments (Atom)