Adding new devices (VMware) to Linux without re-booting server

 

Background

Today, I found myself needing to add 3 new disks to one of my Oracle database server VMware VM’s, unfortunately I was unable to re-boot the server so I followed the steps below to add the new devices.

Create LUN’s using your storage platform and add add them to your Virtual Machine using your preferred  vSphere Client.

newDevices
VMware vSphere Web Client – 3 new devices highlighted

Use yum to install sg3_utils

[root@z-oracle1 ~]# yum install sg3_utils

Use the Linux ‘fdisk’ command to list current devices

[root@z-oracle1 dev]# fdisk -l

Rescan SCSI bus using the rescan-sci-bus.sh script.

[root@z-oracle1 dev]# rescan-scsi-bus.sh
Scanning SCSI subsystem for new devices
Scanning host 0 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning for device 0 0 0 0 …
OLD: Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: NECVMWar Model: VMware IDE CDR00 Rev: 1.00
Type: CD-ROM ANSI SCSI revision: 05
Scanning host 1 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning host 2 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning for device 2 0 0 0 …
OLD: Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: VMware Model: Virtual disk Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
Scanning for device 2 0 1 0 …

Use ‘fdisk’ to identify new device names

[root@z-oracle1 dev]# fdisk -l

Disk /dev/sdi: 1099.5 GB, 1099511627776 bytes, 2147483648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 4194304 bytes

Disk /dev/sdj: 3298.5 GB, 3298534883328 bytes, 6442450944 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 4194304 bytes

Disk /dev/sdk: 1099.5 GB, 1099511627776 bytes, 2147483648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 4194304 bytes

We should now be able to see the device in /dev.

[root@z-oracle1 dev]# ls -l /dev/sd*
brw-rw—-. 1 root disk 8, 0 May 14 14:14 /dev/sda
brw-rw—-. 1 root disk 8, 1 May 14 14:14 /dev/sda1
brw-rw—-. 1 root disk 8, 2 May 14 14:14 /dev/sda2
brw-rw—-. 1 root disk 8, 16 May 14 14:14 /dev/sdb
brw-rw—-. 1 root disk 8, 32 Jul 23 14:31 /dev/sdc
brw-rw—-. 1 root disk 8, 48 Jul 23 14:30 /dev/sdd
brw-rw—-. 1 root disk 8, 64 Jul 23 14:31 /dev/sde
brw-rw—-. 1 root disk 8, 80 Jul 9 21:02 /dev/sdf
brw-rw—-. 1 root disk 8, 96 Jul 9 21:02 /dev/sdg
brw-rw—-. 1 root disk 8, 112 Jul 9 21:02 /dev/sdh
brw-rw—-. 1 root disk 8, 128 Jul 24 10:46 /dev/sdi
brw-rw—-. 1 root disk 8, 144 Jul 24 10:46 /dev/sdj
brw-rw—-. 1 root disk 8, 160 Jul 24 10:46 /dev/sdk

We are now ready to partition our new disks using ‘fdisk’ (n = new p = print w = write).

[root@z-oracle1 dev]# fdisk /dev/sdi
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 0x1fea2f04.

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 (8192-2147483647, default 8192):
Using default value 8192
Last sector, +sectors or +size{K,M,G} (8192-2147483647, default 2147483647):
Using default value 2147483647
Partition 1 of type Linux and of size 1024 GiB is set

Command (m for help): p

Disk /dev/sdi: 1099.5 GB, 1099511627776 bytes, 2147483648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 4194304 bytes
Disk label type: dos
Disk identifier: 0x1fea2f04

Device Boot Start End Blocks Id System
/dev/sdi1 8192 2147483647 1073737728 83 Linux
Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

I then repeated for ‘/dev/sdj’ & ‘/dev/sdk’ and now ready to format the devices e.g. mkfs.ext4 /dev/sdi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: