Find the disk

lonewanderer@debian:~ lsblk
lsblk

Note the name of the device, e.g. /dev/sdb

Create a partition

lonewanderer@debian:~ sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.39.3).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help):
  1. Create a new label by pressing g
  2. Enter n for a new partition.
  3. Choose the size you want
  4. Save changes by pressing w

Format the partition

lonewanderer@debian:~ sudo mkfs -t ext4 /dev/sdb1

Mount the disk persistently

Create the folder where the new disk is going to be mounted:

lonewanderer@debian:~ sudo mkdir /mount-path

Edit /etc/fstab

# <file system>    <mount point>    <type>    <options>    <dump>    <pass>
/dev/sdb1          /mount-path      ext4      defaults     0         0

Test the mount:

lonewanderer@debian:~ sudo mount -a

If no errors, run

lonewanderer@debian:~ sudo systemctl daemon-reload

Resize the partition

This should become its own article, but here we go:

Unmount the partition:

lonewanderer@debian:~ sudo umount /deb/sdb1

Then follow the Guide on Stack Exchange

Enlarge the partition:

lonewanderer@debian:~ sudo fdisk -u /dev/sdb

p to print the partition table, take note of the number, start, end, type of sda1.

Delete it: d

Recreate it using command n with same number (1), start and type but with a bigger end (taking care not to overlap with other partitions). Try to align things on a megabyte boundary that is for end, make it a multiple of 2048 minus 1. Change the type if needed with t (for partitions holding an extX or btrfs filesystem, the default of 83 is fine).

Then w to write and q to quit.

The partition table will have been modified but the kernel will not be able to take that into account as some partitions are mounted.

However, if in-use partitions were only enlarged, you should be able to force the kernel to take the new layout with:

lonewanderer@debian:~ sudo partx /dev/sda

If that fails, you’ll need to reboot. The system should boot just fine.

Then, resize the filesystem so it spreads to the extent of the enlarged partition (might be located in /sbin):

lonewanderer@debian:~ sudo resize2fs /dev/sda1

Which for ext4 will work just fine even on a live FS.