Browse Tag

Expand

Expand local Xenserver Storage

Scenario:

The customer has Dell servers with PERC Raid controller. The volume can be expanded at the Raid controller level, so adding a few disks to the same volume is possible. Xenserver however is not expanding the local storage repository automatically. This is what I am simulating in the Lab environment to find a solution. In a lab it is also very convenient to be able to revert to a snapshot. I First installed Xenserver 7.1U1 on a 80GB disk and then expanded the disk to 100GB.

My test lab:

  1. VMware Workstation 12
  2. Xenserver 7.1U1 installed in VM
  3. During Xenserver setup: Enabled thin provisioning (Optimized storage for Xendesktop)

Storage size after install:

After installation I expanded the virtual disk of this VM (where Xenserver is running in) with 20GB. I tried some suggestions like CTX120865, but this is not working on Xenserver 7.1

 

Solution:

[root@XS71 ~]# pvscan
PV /dev/sda3 VG XSLocalEXT-88dff2e2-f06c-c590-4ba8-c8e11a046c86 lvm2 [38.48 GiB / 0 free]
Total: 1 [38.48 GiB] / in use: 1 [38.48 GiB] / in no VG: 0 [0 ]

[root@XS71 ~]# gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.6

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/sda: 209715200 sectors, 100.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 2116DE1D-4BE4-480F-93FA-D90347718D1E
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 209715166
Partitions will be aligned on 2048-sector boundaries
Total free space is 41945054 sectors (20.0 GiB)

Number Start (sector) End (sector) Size Code Name
1 46139392 83888127 18.0 GiB 0700
2 8390656 46139391 18.0 GiB 0700
3 87033856 167772126 38.5 GiB 8E00
4 83888128 84936703 512.0 MiB EF02
5 2048 8390655 4.0 GiB 0700
6 84936704 87033855 1024.0 MiB 8200

Command (? for help): d
Partition number (1-6): 3

Command (? for help): n
Partition number (3-128, default 3): 3
First sector (34-209715166, default = 87033856) or {+-}size{KMGTP}: 87033856
Last sector (87033856-209715166, default = 209715166) or {+-}size{KMGTP}:
Current type is ‘Linux filesystem’
Hex code or GUID (L to show codes, Enter = 8300): 8E00
Changed type of partition to ‘Linux LVM’

Command (? for help): p
Disk /dev/sda: 209715200 sectors, 100.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 2116DE1D-4BE4-480F-93FA-D90347718D1E
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 209715166
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number Start (sector) End (sector) Size Code Name
1 46139392 83888127 18.0 GiB 0700
2 8390656 46139391 18.0 GiB 0700
3 87033856 209715166 58.5 GiB 8E00 Linux LVM
4 83888128 84936703 512.0 MiB EF02
5 2048 8390655 4.0 GiB 0700
6 84936704 87033855 1024.0 MiB 8200

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sda.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.

[root@XS71 ~]# reboot

[root@XS71 ~]# pvresize /dev/sda3 –config global{metadata_read_only=0}
Physical volume “/dev/sda3” changed
1 physical volume(s) resized / 0 physical volume(s) not resized
[root@XS71 ~]# pvscan
PV /dev/sda3 VG XSLocalEXT-88dff2e2-f06c-c590-4ba8-c8e11a046c86 lvm2 [58.48 GiB / 20.00 GiB free]
Total: 1 [58.48 GiB] / in use: 1 [58.48 GiB] / in no VG: 0 [0 ]

 

 

If you did not used the “optimized for VDI” option during Xenserver install, you can skip to the last command (xe sr-scan).

 

 

[root@XS71 ~]# lvdisplay
— Logical volume —
LV Path /dev/XSLocalEXT-88dff2e2-f06c-c590-4ba8-c8e11a046c86/88dff2e2-f06c-c590-4ba8-c8e11a046c86
LV Name 88dff2e2-f06c-c590-4ba8-c8e11a046c86
VG Name XSLocalEXT-88dff2e2-f06c-c590-4ba8-c8e11a046c86
LV UUID D7VyUL-a6oB-b7bJ-S2AA-4wg4-40TC-JdcOuS
LV Write Access read/write
LV Creation host, time XS71, 2017-11-02 11:39:30 +0100
LV Status available
# open 1
LV Size 38.48 GiB
Current LE 9852
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:0

[root@XS71 ~]# lvresize /dev/XSLocalEXT-88dff2e2-f06c-c590-4ba8-c8e11a046c86/88dff2e2-f06c-c590-4ba8-c8e11a046c86 -l +100%FREE –config global{metadata_read_only=0}
Size of logical volume XSLocalEXT-88dff2e2-f06c-c590-4ba8-c8e11a046c86/88dff2e2-f06c-c590-4ba8-c8e11a046c86 changed from 38.48 GiB (9852 extents) to 58.48 GiB (14972 extents).
Logical volume 88dff2e2-f06c-c590-4ba8-c8e11a046c86 successfully resized.
[root@XS71 ~]# lvdisplay
— Logical volume —
LV Path /dev/XSLocalEXT-88dff2e2-f06c-c590-4ba8-c8e11a046c86/88dff2e2-f06c-c590-4ba8-c8e11a046c86
LV Name 88dff2e2-f06c-c590-4ba8-c8e11a046c86
VG Name XSLocalEXT-88dff2e2-f06c-c590-4ba8-c8e11a046c86
LV UUID D7VyUL-a6oB-b7bJ-S2AA-4wg4-40TC-JdcOuS
LV Write Access read/write
LV Creation host, time XS71, 2017-11-02 11:39:30 +0100
LV Status available
# open 1
LV Size 58.48 GiB
Current LE 14972
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:0

[root@XS71 ~]# resize2fs /dev/XSLocalEXT-88dff2e2-f06c-c590-4ba8-c8e11a046c86/88dff2e2-f06c-c590-4ba8-c8e11a046c86
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/XSLocalEXT-88dff2e2-f06c-c590-4ba8-c8e11a046c86/88dff2e2-f06c-c590-4ba8-c8e11a046c86 is mounted on /run/sr-mount/88dff2e2-f06c-c590-4ba8-c8e11a046c86 ; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 4
The filesystem on /dev/XSLocalEXT-88dff2e2-f06c-c590-4ba8-c8e11a046c86/88dff2e2-f06c-c590-4ba8-c8e11a046c86 is now 15331328 blocks long.

[root@XS71 ~]# xe sr-scan uuid=88dff2e2-f06c-c590-4ba8-c8e11a046c86

Result:

 

Thanks to René for his help with this puzzle.