g2p / blocks

Enable bcache or LVM on existing block devices
GNU General Public License v3.0
375 stars 43 forks source link

bcache resizing #11

Open adamryczkowski opened 10 years ago

adamryczkowski commented 10 years ago

I tried to do sudo blocks to-bcache /dev/sda6 --join b0209c0c-64b1-4ed1-81d5-bed570641246

when I've got the following error:

The filesystem (btrfs) leaves enough room, no need to shrink it
Traceback (most recent call last):
  File "/usr/bin/blocks", line 9, in <module>
    load_entry_point('blocks==0.1.4', 'console_scripts', 'blocks')()
  File "/usr/lib/python3/dist-packages/blocks/__main__.py", line 2002, in script_main
    sys.exit(main())
  File "/usr/lib/python3/dist-packages/blocks/__main__.py", line 1668, in main
    return args.action(args)
  File "/usr/lib/python3/dist-packages/blocks/__main__.py", line 1751, in cmd_to_bcache
    device=device, debug=args.debug, progress=progress, join=args.join)
  File "/usr/lib/python3/dist-packages/blocks/__main__.py", line 1550, in part_to_bcache
    ptable.reserve_space_before(part_start, bsb_size, progress)
  File "/usr/lib/python3/dist-packages/blocks/__main__.py", line 415, in reserve_space_before
    return self._reserve_range(part_start - length, part_start, progress)
  File "/usr/lib/python3/dist-packages/blocks/__main__.py", line 403, in _reserve_range
    block_stack.stack_reserve_end_area(part_newsize, progress)
  File "/usr/lib/python3/dist-packages/blocks/__main__.py", line 1086, in stack_reserve_end_area
    block_data.reserve_end_area_nonrec(inner_pos)
AttributeError: 'BCacheBacking' object has no attribute 'reserve_end_area_nonrec'

/dev/sda6 is formatted as ext4. /dev/sda5 is already a part of this bcache1, and is formatted as btrfrs. /dev/sda7 is a LUKS device, and also a part of the same bcache1.

This is my /dev/sda, as reported by gdisk: Disk /dev/sda: 1465149168 sectors, 698.6 GiB Logical sector size: 512 bytes Disk identifier (GUID): 9225A7F4-41FF-4FC5-99D7-0E4FDFB2DFC3 Partition table holds up to 128 entries First usable sector is 34, last usable sector is 1465149134 Partitions will be aligned on 2048-sector boundaries Total free space is 2014 sectors (1007.0 KiB)

Number Start (sector) End (sector) Size Code Name 1 2048 104447 50.0 MiB EF00 EFI System 2 104448 616447 250.0 MiB 8300 Linux filesystem 3 616448 1128447 250.0 MiB 8300 Linux filesystem 4 1128448 34918399 16.1 GiB 8200 Linux swap 5 34918400 244635647 100.0 GiB 8300 Linux filesystem 6 244635648 559206399 150.0 GiB 8300 Linux filesystem 7 559206400 1465149134 432.0 GiB 0700 Microsoft basic data

Here is info about my bcache1 Device /dev/bcache1 (251:1) UUID b0209c0c-64b1-4ed1-81d5-bed570641246 Block Size 0.50KiB Bucket Size 512.00KiB Congested? False Read Congestion 2.0ms Write Congestion 20.0ms Total Cache Size 62.88GiB Total Cache Used 5.03GiB (8%) Total Cache Unused 57.85GiB (92%) Dirty Data 0B (0%) Evictable Cache 62.88GiB (100%) Replacement Policy [lru] fifo random Cache Mode writethrough [writeback] writearound none Total Hits 83442 (98%) Total Misses 1324 Total Bypass Hits 7583 (100%) Total Bypass Misses 0 Total Bypassed 272.00MiB

adamryczkowski commented 10 years ago

uname -r gives 3.11.0-12-generic. I use Linux Mint 16 64 bit (this distro is based on Ubuntu Saucy).

g2p commented 10 years ago

/dev/sda6 is formatted as ext4. /dev/sda5 is already a part of this bcache1, and is formatted as btrfrs. /dev/sda7 is a LUKS device, and also a part of the same bcache1.

Seems fixable, but it will require a kernel patch. I'll have to confront the bcache maintainer's past refusal of my patch to resize bcache devices from sysfs (a simple but not necessarily easy matter of getting him to take another look), and expand the patch to allow shrinking as well.

I might also ship a custom kernel for --maintboot, which won't require upstream's consent but will be more complicated to support.

adamryczkowski commented 10 years ago

Thank you for your comment. I've managed to do backup and use make-bcache -B /dev/sda5 so at the moment, I don't need this patch right now.

ozmad commented 9 years ago

Hi,

Might I wake this thread up? I've been running the following: blocks to-bcache /dev/sdb3 and got the error below My tech inf is: mint 17.1 (up to date), 3.13.0-37-generic, x86_64 sdb3 is ext4 \ it worked with a test drive one hour earlyer. I am not sure how to check if there are any dirty configurations ("ls /sys/fs/bcache" shows only "register register_quiet" no uuid of any disk) Thanks.

The error:

The filesystem (ext4) leaves enough room, no need to shrink it Traceback (most recent call last): File "/usr/bin/blocks", line 9, in load_entry_point('blocks==0.1.4', 'console_scripts', 'blocks')() File "/root/build-blocks/src/blocks/blocks/main.py", line 2012, in script_main sys.exit(main()) File "/root/build-blocks/src/blocks/blocks/main.py", line 1678, in main return args.action(args) File "/root/build-blocks/src/blocks/blocks/main.py", line 1761, in cmd_to_bcache device=device, debug=args.debug, progress=progress, join=args.join) File "/root/build-blocks/src/blocks/blocks/main.py", line 1560, in part_to_bcache ptable.reserve_space_before(part_start, bsb_size, progress) File "/root/build-blocks/src/blocks/blocks/main.py", line 425, in reserve_space_before return self._reserve_range(part_start - length, part_start, progress) File "/root/build-blocks/src/blocks/blocks/main.py", line 413, in _reserve_range block_stack.stack_reserve_end_area(part_newsize, progress) File "/root/build-blocks/src/blocks/blocks/main.py", line 1096, in stack_reserve_end_area block_data.reserve_end_area_nonrec(inner_pos) AttributeError: 'BCacheBacking' object has no attribute 'reserve_end_area_nonrec'