There are plenty of guides out there describing how to extend or increase the disk space of a second hard drive on a Debian system. Many of them are to complexe and some of them simply don’t works.
After some long struggles, I’ve come up with a few simple steps that I got working on every modern Debian and Ubuntu system out of the box. It might not be the case for you, but I thought it would be nice to share it anyway. Hope it will help someone!
- For virtual systems, increase the disk size in the hypervizor
- Reboot the server
- Stop any services that uses the disk and unmount it (umount /path/to/mount)
- Run parted /dev/sdb (where b is the drive letter)
- Run resizepart -> Type 1 (where 1 is the parition number) -> Type correct disk size -> Hit Ctrl + C
- Unmount the disk again (same as in step 3)
- Run e2fsck -f /dev/sdb1 (where b is the drive letter and 1 is the parition number)
- Run resize2fs /dev/sdb1 (where b is the drive letter and 1 is the parition number)
- Reboot the server
Hint
Type fdisk -l and/or df -h to find out drive letters, partition numbers, mount paths, disk size etc.