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.





















Tuesday, 16 April 2019

Expand XFS filesystem in RHEL 7 using same disk in vSphere/vCenter

Expand  XFS filesystem in RHEL 7 using same disk in vSphere/vCenter



# fdisk -l
Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors

# df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root         20G  5.8G   15G  29% /
devtmpfs                     3.8G     0  3.8G   0% /dev
tmpfs                        3.9G     0  3.9G   0% /dev/shm
tmpfs                        3.9G   13M  3.8G   1% /run
tmpfs                        3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/rhel-opt          15G  781M   15G   6% /opt
/dev/mapper/rhel-tmp          15G   33M   15G   1% /tmp
/dev/mapper/rhel-var          20G  1.6G   19G   8% /var
/dev/mapper/vg_DATA-lv_DATA  100G   33M  100G   1% /DATA
/dev/sda1                   1014M  270M  745M  27% /boot
/dev/mapper/rhel-home         15G  673M   15G   5% /home

We need to increase /DATA by doing expansion on same disk( no new disk).
Increase the disk size at VM from 100G to 200G.

Run below command:
# ls /sys/class/scsi_device/
1:0:0:0  1:0:1:0  2:0:0:0

Here 1:0:0:0 is root disk and 1:0:1:0 is the DATA disk.
To expand DATA at RHEL 7 , run below command:
echo 1 > /sys/class/scsi_device/1\:0\:1\:0/device/rescan

Run fdisk -l and we can see the same disk /dev/sdb has expanded to 200G.
# fdisk -l
Disk /dev/sdb: 214.7 GB, 214748364800 bytes, 419430400 sectors

Now run below to increase physical volume.
# pvresize /dev/sdb
  Physical volume "/dev/sdb" changed
  1 physical volume(s) resized or updated / 0 physical volume(s) not resized

Here we can see that 100G free space has allocated.
# pvs
  PV         VG      Fmt  Attr PSize    PFree
  /dev/sda2  rhel    lvm2 a--   117.00g   4.00m
  /dev/sdb   vg_DATA lvm2 a--  <200.00g 100.00g

Same has visible in volume group:

]# vgs
  VG      #PV #LV #SN Attr   VSize    VFree
  rhel      1   6   0 wz--n-  117.00g   4.00m
  vg_DATA   1   1   0 wz--n- <200.00g 100.00g

# vgdisplay
VG Name               vg_DATA
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <200.00 GiB
  PE Size               4.00 MiB
  Total PE              51199
  Alloc PE / Size       25599 / <100.00 GiB
  Free  PE / Size       25600 / 100.00 GiB

Expand the logical volume:
]#  lvextend -l +100%FREE /dev/mapper/vg_DATA-lv_DATA
  Size of logical volume vg_DATA/lv_DATA changed from <100.00 GiB (25599 extents) to <200.00 GiB (51199 extents).

  Logical volume vg_DATA/lv_DATA successfully resized.


Now expand the partition:

# xfs_growfs /dev/mapper/vg_DATA-lv_DATA
meta-data=/dev/mapper/vg_DATA-lv_DATA isize=512    agcount=4, agsize=6553344 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=26213376, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=12799, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 26213376 to 52427776

We can see that now /DATA has extended to 200G.

# df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root         20G  5.8G   15G  29% /
devtmpfs                     3.8G     0  3.8G   0% /dev
tmpfs                        3.9G     0  3.9G   0% /dev/shm
tmpfs                        3.9G   13M  3.8G   1% /run
tmpfs                        3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/rhel-opt          15G  781M   15G   6% /opt
/dev/mapper/rhel-tmp          15G   33M   15G   1% /tmp
/dev/mapper/rhel-var          20G  1.6G   19G   8% /var
/dev/mapper/vg_DATA-lv_DATA  200G   33M  200G   1% /DATA
/dev/sda1                   1014M  270M  745M  27% /boot















Monday, 8 April 2019

How to Enable EVC in a HPE SimpliVity cluster

Please go through below VMware KBs before proceeding:
EVC modes:
CPU compatibility:

Procedure:
1. Disable vSphere HA 
2. Change DRS mode to Manual 
3. Power Off all VMs except OVCs 
4. Right click on each HPE Simplivity ESXi node and choose "All Simplivity Actions -> Shut Down Virtual Controller.." to shutdown OVCs one by one.
5. Enable EVC mode 
6. Power On all OVCs one by one. Wait between 10-15 minutes for each OVC to let all services to startup. 
7. Login to any OVC and run svt-federation-show. Confirm that all OVCs are Alive and Connected. 
8. Confirm that all ESXi nodes in the cluster can access the same Simplivity datastores.
9. Power On all VMs.