... | ... | @@ -428,15 +428,57 @@ Finally resize the filesystem: |
|
|
|
|
|
See also the [LVM howto](howto/lvm).
|
|
|
|
|
|
#### Resizing without LVM
|
|
|
#### Resizing without LVM, no partitions
|
|
|
|
|
|
If there's no LVM inside the VM (a more common configuration
|
|
|
nowadays), the above procedure will obviously not work.
|
|
|
nowadays), the above procedure will obviously not work. If this is a
|
|
|
secondary disk (e.g. `/dev/sdc`) there is a good chance a partition
|
|
|
was created directly on it and that you do not need to repartition the
|
|
|
drive. This is an example of a good configuration if we want to resize
|
|
|
`sdc`:
|
|
|
|
|
|
You might need to resize the partition manually, which can be done
|
|
|
using fdisk. In the following example we have a `sda1` partition that
|
|
|
we want to extend from 10G to 20G to fill up the free space on
|
|
|
`/dev/sda`. Here is what the partition layout looks like before the resize:
|
|
|
```
|
|
|
root@bacula-director-01:~# lsblk
|
|
|
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
|
|
fd0 2:0 1 4K 0 disk
|
|
|
sda 8:0 0 10G 0 disk
|
|
|
└─sda1 8:1 0 10G 0 part /
|
|
|
sdb 8:16 0 2G 0 disk [SWAP]
|
|
|
sdc 8:32 0 250G 0 disk /srv
|
|
|
```
|
|
|
|
|
|
Note that if we would need to resize `sda`, we'd have to follow the
|
|
|
other procedure, in the next section.
|
|
|
|
|
|
If we check the free disk space on the device we will notice it has
|
|
|
not changed yet:
|
|
|
|
|
|
```
|
|
|
# df -h /srv
|
|
|
Filesystem Size Used Avail Use% Mounted on
|
|
|
/dev/sdc 196G 160G 27G 86% /srv
|
|
|
```
|
|
|
|
|
|
The resize is then simply:
|
|
|
|
|
|
```
|
|
|
# resize2fs /dev/sdc
|
|
|
resize2fs 1.44.5 (15-Dec-2018)
|
|
|
Filesystem at /dev/sdc is mounted on /srv; on-line resizing required
|
|
|
old_desc_blocks = 25, new_desc_blocks = 32
|
|
|
The filesystem on /dev/sdc is now 65536000 (4k) blocks long.
|
|
|
```
|
|
|
|
|
|
Read on for the most complicated scenario.
|
|
|
|
|
|
#### Resizing without LVM, with partitions
|
|
|
|
|
|
If the filesystem to resize is not *directly* on the device, you will
|
|
|
need to resize the partition manually, which can be done using
|
|
|
fdisk. In the following example we have a `sda1` partition that we
|
|
|
want to extend from 10G to 20G to fill up the free space on
|
|
|
`/dev/sda`. Here is what the partition layout looks like before the
|
|
|
resize:
|
|
|
|
|
|
```
|
|
|
# lsblk -a
|
... | ... | @@ -448,16 +490,6 @@ sdb 8:16 0 2G 0 disk [SWAP] |
|
|
sdc 8:32 0 40G 0 disk /srv
|
|
|
```
|
|
|
|
|
|
If `sdc` is the resized disk, the kernel might not have noticed the
|
|
|
size change, and you might need to kick it. There might be easier
|
|
|
ways, but a reboot would sure do it:
|
|
|
|
|
|
reboot
|
|
|
|
|
|
And in that case, the partition is *already* resized, so you do not
|
|
|
need to go through the `fdisk` process below and jump straight to the
|
|
|
last `resize2fs` step.
|
|
|
|
|
|
We use fdisk on the device:
|
|
|
|
|
|
```
|
... | ... | |