Update Workflows/Linux/Expand XFS Filesystem.md
This commit is contained in:
@ -13,13 +13,19 @@ This part should be fairly straight-forward. Using whatever hypervisor is runni
|
||||
This step goes over how to increase the usable space of the virtual disk within the GuestVM itself after it was expanded.
|
||||
|
||||
!!! warning "Be Careful"
|
||||
When you follow these steps, you will be deleting the existing partition and immediately re-creating it. If you do not use the **EXACT SAME** starting sector for the new partition, you will destroy data.
|
||||
When you follow these steps, you will be deleting the existing partition and immediately re-creating it. If you do not use the **EXACT SAME** starting sector for the new partition, you will destroy data. Be sure to read every annotation next to each command to fully understand what you are doing.
|
||||
|
||||
``` sh
|
||||
sudo dnf install gdisk -y
|
||||
gdisk /dev/<diskNumber> # (1)
|
||||
p <ENTER> # (2)
|
||||
d <ENTER> # (3)
|
||||
n <ENTER> # (4)
|
||||
4 <ENTER> # (5)
|
||||
<DEFAULT-FIRST-SECTOR-VALUE> (Just press ENTER) # (6)
|
||||
<DEFAULT-LAST-SECTOR-VALUE> (Just press ENTER) # (7)
|
||||
<FILESYSTEM-TYPE=8300 (Linux Filesystem)> (Just press ENTER) # (8)
|
||||
w <ENTER> # (9)
|
||||
```
|
||||
|
||||
1. The first command needs you to enter the disk identifier. In most cases, this will likely be the first disk, such as `/dev/sda`. You do not need to indicate a partition number in this step, as you will be asked for one in a later step after identifying all of the partitions on this disk in the next command.
|
||||
@ -43,3 +49,35 @@ d <ENTER> # (3)
|
||||
3 3328000 19826687 7.9 GiB 8200
|
||||
4 19826688 1073741790 502.5 GiB 8300 Linux filesystem
|
||||
```
|
||||
4. This tells gdisk to create a new partition.
|
||||
5. This tells gdisk to re-make partition 4 (the one we just deleted in the example).
|
||||
6. We just want to leave this as the default. In my example, it would look like this:
|
||||
`First sector (34-2147483614, default = 19826688) or {+-}size{KMGTP}: 19826688`
|
||||
7. We just want to leave this as the default. In my example, it would look like this:
|
||||
`Last sector (19826688-2147483614, default = 2147483614) or {+-}size{KMGTP}: 2147483614`
|
||||
8. Just leave this as-is and press ENTER without entering any values. Assuming you are using XFS, as this guide was written for, the default "Linux Filesystem" is what you want for XFS.
|
||||
9. This will write the changes to the partition table making them reality instead of just staging the changes.
|
||||
!!! warning "Point of No Return"
|
||||
When you press `w <ENTER>` the changes will be written to disk, meaning there is no turning back unless you have full GuestVM backups with something like Veeam Backup & Replication. Be certain the first and last sector values are correctly configured before proceeding.
|
||||
|
||||
## Detect the New Partition Sizes
|
||||
At this point, the operating system wont detect the changes without a reboot, so we are going to force the operating system to detect them immediately with the following commands to avoid a reboot.
|
||||
``` sh
|
||||
sudo partprobe
|
||||
sudo partx -u /dev/<diskNumber>
|
||||
sudo xfs_growfs /
|
||||
```
|
||||
|
||||
## Validate Storage Expansion
|
||||
At this point, you can leverage `lsblk` or `df -h` to determine if the usable storage space was successfully increased or not. In this example, you can see that I increased my storage space from 512GB to 1TB.
|
||||
|
||||
!!! example
|
||||
`lsblk | grep "sda4"`
|
||||
```
|
||||
└─sda4 8:4 0 1014.5G 0 part /
|
||||
```
|
||||
|
||||
`df -h | grep "sda4"`
|
||||
```
|
||||
/dev/sda4 1015G 145G 871G 15% /
|
||||
```
|
||||
|
Reference in New Issue
Block a user