How to extend centos_root partition on Centos 7 and Hyper-V

0

I've been struggling to get this right and tried plenty of tutorials with no luck.

I have a Centos 7 installed as a guest on Hyper-V and need to expand the disk space on centos root partition. I've already extended VHDX in Hyper-V. I've been following this tutorial but it doesn't increase the logical volume. Below is the output of the disk structure.

[root@atlassian-01 ~]# lsblk;pvs;vgs;lvs;df -h;fdisk -l /dev/sda
NAME                          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                             8:0    0  150G  0 disk
├─sda1                          8:1    0  200M  0 part /boot/efi
├─sda2                          8:2    0    1G  0 part /boot
└─sda3                          8:3    0 28.8G  0 part
  ├─centos_atlassian--01-root 253:0    0 25.8G  0 lvm  /
  └─centos_atlassian--01-swap 253:1    0    3G  0 lvm  [SWAP]
sr0                            11:0    1 1024M  0 rom
  PV         VG                  Fmt  Attr PSize  PFree
  /dev/sda3  centos_atlassian-01 lvm2 a--  28.80g    0
  VG                  #PV #LV #SN Attr   VSize  VFree
  centos_atlassian-01   1   2   0 wz--n- 28.80g    0
  LV   VG                  Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root centos_atlassian-01 -wi-ao---- 25.80g
  swap centos_atlassian-01 -wi-ao----  3.00g
Filesystem                             Size  Used Avail Use% Mounted on
/dev/mapper/centos_atlassian--01-root   26G   26G   17M 100% /
devtmpfs                               3.8G     0  3.8G   0% /dev
tmpfs                                  3.9G  8.0K  3.9G   1% /dev/shm
tmpfs                                  3.9G  8.3M  3.8G   1% /run
tmpfs                                  3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda2                             1014M  134M  881M  14% /boot
/dev/sda1                              200M  9.8M  191M   5% /boot/efi
tmpfs                                  780M     0  780M   0% /run/user/0

Disk /dev/sda: 161.1 GB, 161061273600 bytes, 314572800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1    62914559    31457279+  ee  GPT
Partition 1 does not start on physical sector boundary.

What is the proper way to allocate more space to centos_atlassian--01-root?

Best regards, Jacek

centos
hyper-v
fdisk
gparted
asked on Server Fault Jul 12, 2018 by Jacek Michalski • edited Jul 13, 2018 by Jacek Michalski

1 Answer

1

Ok, I've figured it out. You can't use fdisk on GPT partition. Instead you need to use gdisk.

I have followed this article and everything works like a charm.

I hope that it will help someone :-)

answered on Server Fault Jul 13, 2018 by Jacek Michalski

User contributions licensed under CC BY-SA 3.0