Score:0

Extended partition size didn't work

li flag

I have the following info using df:

 francis@playground  /var/log  sudo df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               2.9G     0  2.9G   0% /dev
tmpfs                              595M   46M  549M   8% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   39G   39G     0 100% /
tmpfs                              3.0G     0  3.0G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock

My volume group is using /dev/sda3.

The thing is, I enlarged the disk of this VM to 81G (it was 40GH). Then, I used fdisk to delete /dev/sda3 and create a new partition with the new space. It worked:

Device       Start       End   Sectors Size Type
/dev/sda1     2048      4095      2048   1M BIOS boot
/dev/sda2     4096   2101247   2097152   1G Linux filesystem
/dev/sda3  2101248 171966430 169865183  81G Linux filesystem


Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 38.97 GiB, 41821405184 bytes, 81682432 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

However, I the volume group doesn't see the new space:

  --- Volume group ---
  VG Name               ubuntu-vg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  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               <38.95 GiB
  PE Size               4.00 MiB
  Total PE              9971
  Alloc PE / Size       9971 / <38.95 GiB
  Free  PE / Size       0 / 0

How can I get it to see the new, enlarged /dev/sda3?

hr flag
You probably need to extend the logical volume and underlying filesystem to take advantage of the new physical volume size - see [Ubuntu does not use full disk space - how to extend?](https://askubuntu.com/questions/1417938/ubuntu-does-not-use-full-disk-space-how-to-extend) but note that `lvextend` now has an option `-r, --resizefs` to take care of the latter automatically
francisaugusto avatar
li flag
@steeldriver It doesn't seem to work: ``` sudo lvextend -l+100%FREE /dev/ubuntu-vg/ubuntu-lv -r Size of logical volume ubuntu-vg/ubuntu-lv unchanged from <38.95 GiB (9971 extents). Logical volume ubuntu-vg/ubuntu-lv successfully resized. resize2fs 1.45.5 (07-Jan-2020) The filesystem is already 10210304 (4k) blocks long. Nothing to do! ```
Score:0
li flag

I guess I had to extend it as directed here: https://unix.stackexchange.com/questions/138090/cant-resize-a-partition-using-resize2fs

I needed to resize the physical volume first with pvresize. After that, the extra space became visible for the volume group/logical volume.

I sit in a Tesla and translated this thread with Ai:

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.