ubuntu_extend_default_lvm_space
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ubuntu_extend_default_lvm_space [2023/06/29 18:26] – wikiadmin | ubuntu_extend_default_lvm_space [2023/06/29 20:01] (current) – wikiadmin | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Ubuntu - Extend Your Default LVM Space ====== | ====== Ubuntu - Extend Your Default LVM Space ====== | ||
+ | |||
+ | So, like me, you installed Ubuntu and accepted the installers default selections for lvm and now your operating volume is very small and the Ubuntu installer did not utilize the entire physical drive. There is a ton of space that is not being utilized. | ||
+ | |||
+ | All credit for the concepts and sequences of commands goes to the publishers of the article that you can find by clicking the following link: | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | |||
+ | This first example below involves a 1TB physical drive of which Ubuntu' | ||
+ | |||
+ | First run df -h | ||
< | < | ||
Line 14: | Line 25: | ||
tmpfs 791M 4.0K 791M 1% / | tmpfs 791M 4.0K 791M 1% / | ||
</ | </ | ||
+ | |||
+ | Next run vgdisplay | ||
< | < | ||
Line 44: | Line 57: | ||
</ | </ | ||
+ | Next run lvdisplay | ||
< | < | ||
Line 67: | Line 81: | ||
Block device | Block device | ||
</ | </ | ||
+ | |||
+ | Switching to root user | ||
< | < | ||
Line 73: | Line 89: | ||
root@svr1: | root@svr1: | ||
</ | </ | ||
+ | |||
+ | Run the following to extend the LV to the maximum size usable. | ||
< | < | ||
Line 109: | Line 127: | ||
root@svr1: | root@svr1: | ||
</ | </ | ||
+ | |||
+ | At this point you have increased the size of the block volume where your root filesystem resides, but you still need to extend the filesystem on top of it. | ||
+ | |||
+ | First, run df -h to verify your (almost full) root file system, then run resize2fs / | ||
+ | |||
+ | This is a continuation of the above: now extending the file system to utilize the entire resized volume on a 1TB physical drive. | ||
+ | |||
+ | Re-established remote ssh connection and want to again switch to root user. | ||
+ | |||
+ | < | ||
+ | ~$ sudo su | ||
+ | [sudo] password for user: | ||
+ | root@svr1:/ | ||
+ | </ | ||
+ | |||
+ | Run df -h to see where we are. Notice that ubuntu--vg-ubuntu--lv | ||
+ | |||
+ | < | ||
+ | root@svr11: | ||
+ | Filesystem | ||
+ | tmpfs 791M 1.2M 790M 1% /run | ||
+ | / | ||
+ | tmpfs 3.9G | ||
+ | tmpfs 5.0M | ||
+ | / | ||
+ | tmpfs 791M 4.0K 791M 1% / | ||
+ | </ | ||
+ | |||
+ | Let's check vgdisplay | ||
+ | |||
+ | < | ||
+ | root@svr1: | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | --- Volume group --- | ||
+ | VG Name | ||
+ | System ID | ||
+ | Format | ||
+ | Metadata Areas 1 | ||
+ | Metadata Sequence No 3 | ||
+ | VG Access | ||
+ | VG Status | ||
+ | MAX LV 0 | ||
+ | Cur LV 1 | ||
+ | Open LV 1 | ||
+ | Max PV 0 | ||
+ | Cur PV 1 | ||
+ | Act PV 1 | ||
+ | VG Size < | ||
+ | PE Size 4.00 MiB | ||
+ | Total PE 237823 | ||
+ | Alloc PE / Size | ||
+ | Free PE / Size 0 / 0 | ||
+ | VG UUID | ||
+ | </ | ||
+ | |||
+ | Let's check lvdisplay | ||
+ | |||
+ | < | ||
+ | root@svr1: | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | --- Logical volume --- | ||
+ | LV Path / | ||
+ | LV Name ubuntu-lv | ||
+ | VG Name ubuntu-vg | ||
+ | LV UUID xUUIxr-wnDl-7ZNk-EQpK-gAwb-Wug0-a7JSTb | ||
+ | LV Write Access | ||
+ | LV Creation host, time ubuntu-server, | ||
+ | LV Status | ||
+ | # open 1 | ||
+ | LV Size <929.00 GiB | ||
+ | Current LE | ||
+ | Segments | ||
+ | Allocation | ||
+ | Read ahead sectors | ||
+ | - currently set to 256 | ||
+ | Block device | ||
+ | </ | ||
+ | |||
+ | Now, run the following command to resize the file system to the full size of the resized volume. | ||
+ | |||
+ | < | ||
+ | root@svr1: | ||
+ | resize2fs 1.46.5 (30-Dec-2021) | ||
+ | Filesystem at / | ||
+ | old_desc_blocks = 13, new_desc_blocks = 117 | ||
+ | The filesystem on / | ||
+ | |||
+ | root@svr1: | ||
+ | </ | ||
+ | |||
+ | Run df -h | ||
+ | |||
+ | And notice that ' | ||
+ | |||
+ | < | ||
+ | root@svr1: | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | Filesystem | ||
+ | tmpfs 791M 1.2M 790M 1% /run | ||
+ | / | ||
+ | tmpfs 3.9G | ||
+ | tmpfs 5.0M | ||
+ | / | ||
+ | tmpfs 791M 4.0K 791M 1% / | ||
+ | root@svr1: | ||
+ | |||
+ | </ | ||
+ | |||
+ | **End of resizing on the 1TB physical drive. | ||
+ | |||
+ | |||
+ | FOLLOWING IS ANOTHER UNRELATED EXAMPLE OF THE SECOND PART OF THE PROCESS: | ||
+ | |||
+ | Example 2: | ||
+ | |||
+ | Note: The following operations and output involves a 2TB physical drive instead of 1TB (like above). | ||
+ | |||
+ | Again, at this point we have increased the size of the block volume where your root filesystem resides, but you still need to extend the filesystem on top of it. | ||
+ | |||
+ | First, run df -h to verify your (almost full) root file system, then run resize2fs / | ||
+ | |||
+ | Here are the new readings for ' | ||
+ | |||
+ | < | ||
+ | |||
+ | Logical volume ubuntu-vg/ | ||
+ | root@svr3: | ||
+ | --- Logical volume --- | ||
+ | LV Path / | ||
+ | LV Name ubuntu-lv | ||
+ | VG Name ubuntu-vg | ||
+ | LV UUID 0FjNEm-jrLm-tYWv-AzHT-TZmm-l9bx-aVWpyR | ||
+ | LV Write Access | ||
+ | LV Creation host, time ubuntu-server, | ||
+ | LV Status | ||
+ | # open 1 | ||
+ | LV Size <1.82 TiB | ||
+ | Current LE | ||
+ | Segments | ||
+ | Allocation | ||
+ | Read ahead sectors | ||
+ | - currently set to 256 | ||
+ | Block device | ||
+ | |||
+ | root@svr3: | ||
+ | Filesystem | ||
+ | tmpfs 1.6G 1.2M 1.6G 1% /run | ||
+ | / | ||
+ | tmpfs 7.8G | ||
+ | tmpfs 5.0M | ||
+ | / | ||
+ | tmpfs 1.6G 4.0K 1.6G 1% / | ||
+ | </ | ||
+ | |||
+ | Now, run the following command to extend your filesystem. | ||
+ | |||
+ | < | ||
+ | root@svr3: | ||
+ | </ | ||
+ | |||
+ | Results | ||
+ | |||
+ | < | ||
+ | resize2fs 1.46.5 (30-Dec-2021) | ||
+ | Filesystem at / | ||
+ | old_desc_blocks = 13, new_desc_blocks = 233 | ||
+ | The filesystem on / | ||
+ | </ | ||
+ | |||
+ | Run df -h again. | ||
+ | |||
+ | < | ||
+ | root@svr3: | ||
+ | Filesystem | ||
+ | tmpfs 1.6G 1.2M 1.6G 1% /run | ||
+ | / | ||
+ | tmpfs 7.8G | ||
+ | tmpfs 5.0M | ||
+ | / | ||
+ | tmpfs 1.6G 4.0K 1.6G 1% / | ||
+ | root@nc3:~# | ||
+ | </ | ||
+ | |||
+ | Run vgdisplay again | ||
+ | |||
+ | < | ||
+ | root@svr3: | ||
+ | --- Volume group --- | ||
+ | VG Name | ||
+ | System ID | ||
+ | Format | ||
+ | Metadata Areas 1 | ||
+ | Metadata Sequence No 3 | ||
+ | VG Access | ||
+ | VG Status | ||
+ | MAX LV 0 | ||
+ | Cur LV 1 | ||
+ | Open LV 1 | ||
+ | Max PV 0 | ||
+ | Cur PV 1 | ||
+ | Act PV 1 | ||
+ | VG Size < | ||
+ | PE Size 4.00 MiB | ||
+ | Total PE 476287 | ||
+ | Alloc PE / Size | ||
+ | Free PE / Size 0 / 0 | ||
+ | VG UUID | ||
+ | </ | ||
+ | |||
+ | Run lvdisplay again | ||
+ | |||
+ | < | ||
+ | root@svr3: | ||
+ | --- Logical volume --- | ||
+ | LV Path / | ||
+ | LV Name ubuntu-lv | ||
+ | VG Name ubuntu-vg | ||
+ | LV UUID 0FjNEm-jrLm-tYWv-AzHT-TZmm-l9bx-aVWpyR | ||
+ | LV Write Access | ||
+ | LV Creation host, time ubuntu-server, | ||
+ | LV Status | ||
+ | # open 1 | ||
+ | LV Size <1.82 TiB | ||
+ | Current LE | ||
+ | Segments | ||
+ | Allocation | ||
+ | Read ahead sectors | ||
+ | - currently set to 256 | ||
+ | Block device | ||
+ | |||
+ | root@svr3: | ||
+ | </ | ||
+ | |||
+ | VG Size and LV Size are both <1.82 TiB | ||
+ | |||
+ | I believe we're done here. | ||
+ |
ubuntu_extend_default_lvm_space.1688063206.txt.gz · Last modified: 2023/06/29 18:26 by wikiadmin