Resizing of btrfs
partition (in my case it's Odroid U3
's Ubuntu Jammy
image from here) by adding extra 3GB @ 16GB SD Card connected via USB adapter to Linux Mint
box with using parted
utility. Distrib image contains 2 partitions, boot
and root
- we are working with second @ /dev/sda2
here.
➜ ✗ df -h /dev/sda2
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 3,0G 2,8G 21M 100% /media/vit/rootpart
➜ ✗ umount /dev/sda2
➜ ✗ parted -l
Model: MXT-USB Storage Device (scsi)
Disk /dev/sda: 15,9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 16,8MB 554MB 537MB primary ext2 boot
2 554MB 3758MB 3204MB primary btrfs
~...~
➜ ✗ echo 1 > /sys/block/sda/device/rescan
➜ ✗ parted /dev/sda
GNU Parted 3.4
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) help
align-check TYPE N check partition N for TYPE(min|opt) alignment
help [COMMAND] print general help, or help on COMMAND
mklabel,mktable LABEL-TYPE create a new disklabel (partition table)
mkpart PART-TYPE [FS-TYPE] START END make a partition
name NUMBER NAME name partition NUMBER as NAME
print [devices|free|list,all|NUMBER] display the partition table, available devices, free space, all found partitions, or a particular partition
quit exit program
rescue START END rescue a lost partition near START and END
resizepart NUMBER END resize partition NUMBER
rm NUMBER delete partition NUMBER
select DEVICE choose the device to edit
disk_set FLAG STATE change the FLAG on selected device
disk_toggle [FLAG] toggle the state of FLAG on selected device
set NUMBER FLAG STATE change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER
unit UNIT set the default unit to UNIT
version display the version number and copyright information of GNU Parted
(parted) print
Model: MXT-USB Storage Device (scsi)
Disk /dev/sda: 15,9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 16,8MB 554MB 537MB primary ext2 boot
2 554MB 3758MB 3204MB primary btrfs
(parted) resizepart 2
Warning: Partition /dev/sda2 is being used. Are you sure you want to continue?
Yes/No? Yes
End? [3758MB]? 6758MB
(parted) print
Model: MXT-USB Storage Device (scsi)
Disk /dev/sda: 15,9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 16,8MB 554MB 537MB primary ext2 boot
2 554MB 6758MB 6204MB primary btrfs
(parted) quit
Information: You may need to update /etc/fstab.
➜ ✗ parted -l
Model: MXT-USB Storage Device (scsi)
Disk /dev/sda: 15,9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 16,8MB 554MB 537MB primary ext2 boot
2 554MB 6758MB 6204MB primary btrfs
~...~
➜ ✗ mount /dev/sda2 /mnt
➜ ✗ btrfs filesystem resize max /mnt
Resize device id 1 (/dev/sda2) from 2.98GiB to max
➜ ✗ df -h /dev/sda2
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 5,8G 2,8G 2,9G 50% /mnt
➜ ✗ umount /dev/sda2
➜ ✗