I am trying to riddle out how to resize a BTRFS partition _and_ the underlying image file.
I created a image file:
$ truncate -s4G btrfs.img
I mounted and formatted the image as BTRFS volume:
$ ld=$(losetup --show --find btrfs.img); echo "$ld"
$ mkfs -t btrfs "$ld"
$ mkdir /mnt/btrfs_img
$ mount "$ld" /mnt/btrfs_img
I can resize the partition inside the image.
$ btrfs filesystem resize 2G /mnt/btrfs_img
$ btrfs filesystem resize 3G /mnt/btrfs_img
How do I resize the partition and the image file (btrfs.img)? I know I
can hack it with 'truncate' on the image file to shrink it but that does
not allow to grow the image file or grow the partition while
necessarily increasing the image file size. If I want to shrink the
partition to 2G, or grow it to 6G, how do I get the image file to
accurately shrink and grow with the partition?
How do I resize the partition and the image file (btrfs.img)? I know I
can hack it with 'truncate' on the image file to shrink it but that does
not allow to grow the image file or grow the partition while
necessarily increasing the image file size. If I want to shrink the
partition to 2G, or grow it to 6G, how do I get the image file to
accurately shrink and grow with the partition?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 491 |
Nodes: | 16 (2 / 14) |
Uptime: | 108:58:19 |
Calls: | 9,684 |
Files: | 13,725 |
Messages: | 6,175,688 |