Thursday, 18 April 2019

Remove a disk from RHEL7 safely without reboot in vmware\vSphere VM

Before proceeding please make sure that the disks are no longer in use by any file systems, logical volumes, volume groups or most importantly raw devices.
Run "fdsik -l" and identify which disk has to be remove.
# fdisk -l | grep /dev/sd
Disk /dev/sda: 128.8 GB, 128849018880 bytes, 251658240 sectors
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   247472127   122686464   8e  Linux LVM
Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Disk /dev/sdc: 536.9 GB, 536870912000 bytes, 1048576000 sectors
Disk /dev/sdd: 322.1 GB, 322122547200 bytes, 629145600 sectors

Disk /dev/sde: 322.1 GB, 322122547200 bytes, 629145600 sectors

Make /dev/sde offline:

# echo "offline" > /sys/block/sde/device/state

Now , delete the disk:
# echo "1" > /sys/block/sde/device/delete

validate the same:
# fdisk -l | grep /dev/sd
Disk /dev/sda: 128.8 GB, 128849018880 bytes, 251658240 sectors
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   247472127   122686464   8e  Linux LVM
Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Disk /dev/sdc: 536.9 GB, 536870912000 bytes, 1048576000 sectors

Disk /dev/sdd: 322.1 GB, 322122547200 bytes, 629145600 sectors

Now we see that disk has removed from OS (RHEL7).
Now remove the disk safely form VM--> edit settings--> remove hard disk.





















No comments:

Post a Comment