Score:0

How to increase 1st partition size via terminal only when there are second and third adjacent partitions for NVME

in flag

This is on an AWS EC2 M5a with EBS (Ubuntu 16.04)

NAME                MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT

nvme0n1              259:1    0    50G  0 disk 
├─nvme0n1p1          259:2    0    20G  0 part /
├─nvme0n1p2          259:3    0     2G  0 part [SWAP]
└─nvme0n1p3          259:4    0    28G  0 part 
  ├─vg_abcdef-logs      251:1    0     8G  0 lvm  /var/log
  └─vg_abcdef-app       251:2    0    19G  0 lvm  /home/abcdef
nvme1n1              259:0    0    50G  0 disk 
└─vg_backups-backups 251:0    0    49G  0 lvm  /home/abcdef/Backups-Disk

I added 50GB to the disk (nvme0n1)/EBS volume for a total of 100GB and need to expand the first partition (root /). I have the following:

NAME                MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT

nvme0n1              259:1    0   100G  0 disk 
├─nvme0n1p1          259:2    0    20G  0 part /
├─nvme0n1p2          259:3    0     2G  0 part [SWAP]
└─nvme0n1p3          259:4    0    28G  0 part 
  ├─vg_abcdef-logs      251:1    0     8G  0 lvm  /var/log
  └─vg_abcdef-app       251:2    0    19G  0 lvm  /home/abcdef
nvme1n1              259:0    0    50G  0 disk 
└─vg_backups-backups 251:0    0    49G  0 lvm  /home/abcdef/Backups-Disk

The resize2fs command wont work on the first partition because there is a second and third partition right after it. As you will see below - resize2fs will work on the third (nvme0n1p3)

NAME                MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT

nvme0n1              259:1    0   100G  0 disk 
├─nvme0n1p1          259:2    0    20G  0 part /
├─nvme0n1p2          259:3    0     2G  0 part [SWAP]
└─nvme0n1p3          259:4    0    78G  0 part 
  ├─vg_abcdef-logs      251:1    0     8G  0 lvm  /var/log
  └─vg_abcdef-app       251:2    0    19G  0 lvm  /home/abcdef
nvme1n1              259:0    0    50G  0 disk 
└─vg_backups-backups 251:0    0    49G  0 lvm  /home/abcdef/Backups-Disk

How do I move the second and third partitions (via terminal/CLI only) whereas there is enough space to expand (extend file system) on the first partition? Preferably a solution wherein I do not have to stop and restart the EC2 instance, however, all good if it is necessary.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.