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 19:16] – 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 default | + | So, like me, you installed Ubuntu and accepted the installers |
+ | |||
+ | 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: | ||
- | All credit goes to this article: | ||
[[https:// | [[https:// | ||
+ | |||
+ | This first example below involves a 1TB physical drive of which Ubuntu' | ||
+ | |||
+ | First run df -h | ||
< | < | ||
Line 20: | Line 25: | ||
tmpfs 791M 4.0K 791M 1% / | tmpfs 791M 4.0K 791M 1% / | ||
</ | </ | ||
+ | |||
+ | Next run vgdisplay | ||
< | < | ||
Line 50: | Line 57: | ||
</ | </ | ||
+ | Next run lvdisplay | ||
< | < | ||
Line 73: | Line 81: | ||
Block device | Block device | ||
</ | </ | ||
+ | |||
+ | Switching to root user | ||
< | < | ||
Line 79: | Line 89: | ||
root@svr1: | root@svr1: | ||
</ | </ | ||
+ | |||
+ | Run the following to extend the LV to the maximum size usable. | ||
< | < | ||
Line 120: | Line 132: | ||
First, run df -h to verify your (almost full) root file system, then run resize2fs / | First, run df -h to verify your (almost full) root file system, then run resize2fs / | ||
- | Note: The following operations and output involves a 2TB physical drive instead of 1TB. | + | 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 ' | Here are the new readings for ' | ||
Line 158: | Line 290: | ||
< | < | ||
- | root@nc3:~# resize2fs / | + | root@svr3:~# resize2fs / |
</ | </ | ||
Line 173: | Line 305: | ||
< | < | ||
- | root@nc3:~# df -h | + | root@svr3:~# df -h |
Filesystem | Filesystem | ||
tmpfs 1.6G 1.2M 1.6G 1% /run | tmpfs 1.6G 1.2M 1.6G 1% /run | ||
Line 187: | Line 319: | ||
< | < | ||
- | root@nsvr3:~# vgdisplay | + | root@svr3:~# vgdisplay |
--- Volume group --- | --- Volume group --- | ||
VG Name | VG Name |
ubuntu_extend_default_lvm_space.1688066189.txt.gz · Last modified: 2023/06/29 19:16 by wikiadmin