Customer asked for it…. Customer got it….
(and I was scared as hell…..)
a. Check if the gdisk is installed – if not install it
# rpm -qa | grep gdisk
# yum install gdisk
this if for RHEL/Centos… For ubuntu use apt 😉
b. Convert disk from MBR to GPT – just run gdisk, write and reboot
scary part number 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
[root@xyz ~]# pvs PV VG Fmt Attr PSize PFree /dev/sda2 vg_os lvm2 a– <279.17g <73.17g /dev/sdb1 vg_ora lvm2 a– <2.00t <1.29t [root@xyz ~]# gdisk /dev/sdb GPT fdisk (gdisk) version 0.8.6 Partition table scan: MBR: MBR only BSD: not present APM: not present GPT: not present *************************************************************** Found invalid GPT and valid MBR; converting MBR to GPT format. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by typing ‘q’ if you don’t want to convert your MBR partitions to GPT format! *************************************************************** 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/sdb. 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@xyz ~]# reboot |
b. After reboot resize the partition – with gdisk delete the partition an immediately create new but bigger on the same place (use offered default values when creating) and reboot
scarry part number 2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
[root@xyz ~]# pvs PV VG Fmt Attr PSize PFree /dev/sda2 vg_os lvm2 a– <279.17g <73.17g /dev/sdb1 vg_ora lvm2 a– <2.00t <1.29t [root@xyz ~]# gdisk /dev/sdb 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): d Using 1 Command (? for help): n Partition number (1-128, default 1): First sector (34-7032478862, default = 2048) or {+-}size{KMGTP}: Last sector (2048-7032478862, default = 7032478862) 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/sdb: 7032478896 sectors, 3.3 TiB Logical sector size: 512 bytes Disk identifier (GUID): 6EBDDE82-7B81-4EF3-8524-641446C13FBA Partition table holds up to 128 entries First usable sector is 34, last usable sector is 7032478862 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 2048 7032478862 3.3 TiB 8E00 Linux LVM 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/sdb. 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@xyz ~]# reboot |
c. After reboot resize the LVM Physical volume and verify free space grew
yeah… piece of cake….
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
[root@xyz ~]# pvs PV VG Fmt Attr PSize PFree /dev/sda2 vg_os lvm2 a– <279.17g <73.17g /dev/sdb1 vg_ora lvm2 a– <2.00t <1.29t [root@xyz ~]# parted /dev/sdb print free Model: HP LOGICAL VOLUME (scsi) Disk /dev/sdb: 3601GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 17.4kB 1049kB 1031kB Free Space 1 1049kB 3601GB 3601GB Linux LVM lvm [root@xyz ~]# pvresize /dev/sdb1 Physical volume “/dev/sdb1” changed 1 physical volume(s) resized / 0 physical volume(s) not resized [root@xyz ~]# pvs PV VG Fmt Attr PSize PFree /dev/sda2 vg_os lvm2 a– <279.17g <73.17g /dev/sdb1 vg_ora lvm2 a– 3.27t 2.56t [root@xyz ~]# vgs VG #PV #LV #SN Attr VSize VFree vg_ora 1 2 0 wz–n- 3.27t 2.56t vg_os 1 7 0 wz–n- <279.17g <73.17g [root@xyz ~]# |
In theory – we can do all this online without reboot. I tried it in my lab and it worked….. But just to be sure and play it safe I like to refresh all changes related to partitions with reboot.
Leave a Reply