koverstreet / bcachefs-tools

http://bcachefs.org
GNU General Public License v2.0
120 stars 89 forks source link

Filesystem only mounts with OLD_BLKID_UUID with lots of poorly formatted errors #192

Open andrewbaxter opened 9 months ago

andrewbaxter commented 9 months ago

Using UUID= with bcachefs mount fails:

$ sudo bcachefs mount -v UUID=50b6fc6a-df97-42ff-81ae-71eec426c70c /mymount/
DEBUG - bcachefs_rust::cmd_mount: enumerating devices with UUID 50b6fc6a-df97-42ff-81ae-71eec426c70c
DEBUG - bcachefs_rust::cmd_mount: enumerating udev devices
INFO - bcachefs_rust::cmd_mount: mounting with params: device: /dev/sda:/dev/sdb, target: /mymount/, options: 
DEBUG - bcachefs_rust::cmd_mount: parsing mount options: 
INFO - bcachefs_rust::cmd_mount: mounting bcachefs filesystem, /mymount/
INFO - bcachefs_rust::cmd_mount: mounting filesystem
ERROR - bcachefs_rust::cmd_mount: Fatal error: No such device
bcachefs (/dev/sdc): error reading default superblock: Not a bcachefs superblockbcachefs (/dev/sdc): error reading superblock: Not a bcachefs superblock layoutbcachefs (/dev/sdc1): error reading default superblock: Not a bcachefs superblockbcachefs (/dev/sdc1): error reading superblock: Not a bcachefs superblock layoutbcachefs (/dev/sdc2): error reading default superblock: Not a bcachefs superblockbcachefs (/dev/sdc2): error reading superblock: Not a bcachefs superblock layoutbcachefs (/dev/loop0): error reading default superblock: Not a bcachefs superblockbcachefs (/dev/loop0): error reading superblock: Not a bcachefs superblock layoutbcachefs (/dev/loop1): error reading default superblock: IO error: -5bcachefs (/dev/loop1): error reading superblock: IO error: -5bcachefs (/dev/loop2): error reading default superblock: IO error: -5bcachefs (/dev/loop2): error reading superblock: IO error: -5bcachefs (/dev/loop3): error reading default superblock: IO error: -5bcachefs (/dev/loop3): error reading superblock: IO error: -5bcachefs (/dev/loop4): error reading default superblock: IO error: -5bcachefs (/dev/loop4): error reading superblock: IO error: -5bcachefs (/dev/loop5): error reading default superblock: IO error: -5bcachefs (/dev/loop5): error reading superblock: IO error: -5bcachefs (/dev/loop6): error reading default superblock: IO error: -5bcachefs (/dev/loop6): error reading superblock: IO error: -5bcachefs (/dev/loop7): error reading default superblock: IO error: -5bcachefs (/dev/loop7): error reading superblock: IO error: -5

Using OLD_BLKID_UUID with bcachefs mount also fails:

$ sudo bcachefs mount -v OLD_BLKID_UUID=50b6fc6a-df97-42ff-81ae-71eec426c70c /mymount/
DEBUG - bcachefs_rust::cmd_mount: enumerating devices with UUID 50b6fc6a-df97-42ff-81ae-71eec426c70c
DEBUG - bcachefs_rust::cmd_mount: enumerating udev devices
INFO - bcachefs_rust::cmd_mount: mounting with params: device: /dev/sda:/dev/sdb, target: /mymount/, options: 
DEBUG - bcachefs_rust::cmd_mount: parsing mount options: 
INFO - bcachefs_rust::cmd_mount: mounting bcachefs filesystem, /mymount/
INFO - bcachefs_rust::cmd_mount: mounting filesystem
ERROR - bcachefs_rust::cmd_mount: Fatal error: No such device
bcachefs (/dev/sdc): error reading default superblock: Not a bcachefs superblockbcachefs (/dev/sdc): error reading superblock: Not a bcachefs superblock layoutbcachefs (/dev/sdc1): error reading default superblock: Not a bcachefs superblockbcachefs (/dev/sdc1): error reading superblock: Not a bcachefs superblock layoutbcachefs (/dev/sdc2): error reading default superblock: Not a bcachefs superblockbcachefs (/dev/sdc2): error reading superblock: Not a bcachefs superblock layoutbcachefs (/dev/loop0): error reading default superblock: Not a bcachefs superblockbcachefs (/dev/loop0): error reading superblock: Not a bcachefs superblock layoutbcachefs (/dev/loop1): error reading default superblock: IO error: -5bcachefs (/dev/loop1): error reading superblock: IO error: -5bcachefs (/dev/loop2): error reading default superblock: IO error: -5bcachefs (/dev/loop2): error reading superblock: IO error: -5bcachefs (/dev/loop3): error reading default superblock: IO error: -5bcachefs (/dev/loop3): error reading superblock: IO error: -5bcachefs (/dev/loop4): error reading default superblock: IO error: -5bcachefs (/dev/loop4): error reading superblock: IO error: -5bcachefs (/dev/loop5): error reading default superblock: IO error: -5bcachefs (/dev/loop5): error reading superblock: IO error: -5bcachefs (/dev/loop6): error reading default superblock: IO error: -5bcachefs (/dev/loop6): error reading superblock: IO error: -5bcachefs (/dev/loop7): error reading default superblock: IO error: -5bcachefs (/dev/loop7): error reading superblock: IO error: -5

Only mounting with mount -t bcachefs OLD_BLKID_UUID= works:

$ sudo mount -t bcachefs OLD_BLKID_UUID=50b6fc6a-df97-42ff-81ae-71eec426c70c /mymount
bcachefs (/dev/sdc): error reading default superblock: Not a bcachefs superblockbcachefs (/dev/sdc): error reading superblock: Not a bcachefs superblock layoutbcachefs (/dev/sdc1): error reading default superblock: Not a bcachefs superblockbcachefs (/dev/sdc1): error reading superblock: Not a bcachefs superblock layoutbcachefs (/dev/sdc2): error reading default superblock: Not a bcachefs superblockbcachefs (/dev/sdc2): error reading superblock: Not a bcachefs superblock layoutbcachefs (/dev/loop0): error reading default superblock: Not a bcachefs superblockbcachefs (/dev/loop0): error reading superblock: Not a bcachefs superblock layoutbcachefs (/dev/loop1): error reading default superblock: IO error: -5bcachefs (/dev/loop1): error reading superblock: IO error: -5bcachefs (/dev/loop2): error reading default superblock: IO error: -5bcachefs (/dev/loop2): error reading superblock: IO error: -5bcachefs (/dev/loop3): error reading default superblock: IO error: -5bcachefs (/dev/loop3): error reading superblock: IO error: -5bcachefs (/dev/loop4): error reading default superblock: IO error: -5bcachefs (/dev/loop4): error reading superblock: IO error: -5bcachefs (/dev/loop5): error reading default superblock: IO error: -5bcachefs (/dev/loop5): error reading superblock: IO error: -5bcachefs (/dev/loop6): error reading default superblock: IO error: -5bcachefs (/dev/loop6): error reading superblock: IO error: -5bcachefs (/dev/loop7): error reading default superblock: IO error: -5bcachefs (/dev/loop7): error reading superblock: IO error: -5
$ echo $?
0

$ ls /mymount/
mydir1 mydir2 ...

I set up bcachefs with an older bcachefs version some months ago. show-super works fine and shows:

$ sudo bcachefs show-super /dev/sdb
External UUID:                              50b6fc6a-df97-42ff-81ae-71eec426c70c
Internal UUID:                              59cda41c-3d1f-4ee6-820f-aac9686acdc8
Device index:                               0
Label:                                      mylabel
Version:                                    0.26: lru_v2
Version upgrade complete:                   0.26: lru_v2
Oldest version on disk:                     0.26: lru_v2
Created:                                    Sat Jun  3 17:23:10 2023

Sequence number:                            697
Superblock size:                            4328
Clean:                                      0
Devices:                                    2
Sections:                                   members_v1,replicas_v0,disk_groups,clean,journal_v2,counters
Features:                                   lz4,new_siphash,inline_data,new_extent_overwrite,btree_ptr_v2,extents_above_btree_updates,btree_updates_journalled,new_varint,journal_no_flush,alloc_v2,extents_across_btree_nodes
Compat features:                            alloc_info,alloc_metadata,extents_above_btree_updates_done,bformat_overflow_done

Options:
  block_size:                               512 B
  btree_node_size:                          256 KiB
  errors:                                   continue [ro] panic 
  metadata_replicas:                        2
  data_replicas:                            2
  metadata_replicas_required:               1
  data_replicas_required:                   1
  encoded_extent_max:                       64.0 KiB
  metadata_checksum:                        none [crc32c] crc64 xxhash 
  data_checksum:                            none [crc32c] crc64 xxhash 
  compression:                              lz4
  background_compression:                   none
  str_hash:                                 crc32c crc64 [siphash] 
  metadata_target:                          none
  foreground_target:                        ssd
  background_target:                        hdd
  promote_target:                           ssd
  erasure_code:                             0
  inodes_32bit:                             1
  shard_inode_numbers:                      1
  inodes_use_key_cache:                     1
  gc_reserve_percent:                       8
  gc_reserve_bytes:                         0 B
  root_reserve_percent:                     0
  wide_macs:                                0
  acl:                                      1
  usrquota:                                 0
  grpquota:                                 0
  prjquota:                                 0
  journal_flush_delay:                      1000
  journal_flush_disabled:                   0
  journal_reclaim_delay:                    100
  journal_transaction_names:                0
  version_upgrade:                          [compatible] incompatible none 
  nocow:                                    0

members_v1 (size 120):
  Device:                                   0
    Label:                                  ssd1 (1)
    UUID:                                   cfd93bd9-69a8-4a69-9051-264a3e14903a
    Size:                                   1.82 TiB
    read errors:                            0
    write errors:                           0
    checksum errors:                        0
    seqread iops:                           0
    seqwrite iops:                          0
    randread iops:                          0
    randwrite iops:                         0
    Bucket size:                            512 KiB
    First bucket:                           0
    Buckets:                                3815458
    Last mount:                             Sat Dec  9 03:46:47 2023

    State:                                  rw
    Data allowed:                           journal,btree,user
    Has data:                               journal,btree,user
    Discard:                                0
    Freespace initialized:                  1
  Device:                                   1
    Label:                                  hdd1 (3)
    UUID:                                   7021576c-9774-4996-a409-b78449d00d92
    Size:                                   1.82 TiB
    read errors:                            0
    write errors:                           0
    checksum errors:                        0
    seqread iops:                           0
    seqwrite iops:                          0
    randread iops:                          0
    randwrite iops:                         0
    Bucket size:                            512 KiB
    First bucket:                           0
    Buckets:                                3815458
    Last mount:                             Sat Dec  9 03:46:47 2023

    State:                                  rw
    Data allowed:                           journal,btree,user
    Has data:                               journal,btree,user
    Discard:                                0
    Freespace initialized:                  1

I thought I read that there's some issue with blkid uuids and it sounds like there's a better way to do this (using bcachefs-tools' own scanning?). The UUID is listed correctly in the show-super output, so I feel like this should work, and I'd like to use the appropriate setup. The errors with broken newlines also make me nervous.

There's no documentation around OLD_BLKID_UUID besides the commit. Trying to infer idiomatic usage here:

  1. New versions of blkid support bcachefs so mount -t bcachefs UUID=X will work and using UUID this way is normal
  2. For old versions of blkid, OLD_BLKID_UUID is a workaround that uses bcachefs's own UUID search mechanism?

However

$ blkid -V
blkid from util-linux 2.39.2  (libblkid 2.39.2, 17-Aug-2023)

so UUID should work for me.

Additionally

linux 6.4.16
bcachefs-tools 1.3.1

I'm on nixos, and just confirming that everything's on the same version:

$ which bcachefs
/run/current-system/sw/bin/bcachefs

$ ls -lh /run/current-system/sw/bin/bcachefs
lrwxrwxrwx 1 root root 77 Jan  1  1970 /run/current-system/sw/bin/bcachefs -> /nix/store/aa1ifb38rh5cjzkjk2833nhxxs7qnd99-bcachefs-tools-1.3.1/bin/bcachefs

$ which mount.bcachefs 
/run/current-system/sw/bin/mount.bcachefs

$ ls -lh /run/current-system/sw/bin/mount.bcachefs
lrwxrwxrwx 1 root root 83 Jan  1  1970 /run/current-system/sw/bin/mount.bcachefs -> /nix/store/aa1ifb38rh5cjzkjk2833nhxxs7qnd99-bcachefs-tools-1.3.1/bin/mount.bcachefs

I guess my questions are

  1. Why doesn't bcachefs mount work with UUID= or OLD_BLKID_UUID?
  2. Why doesn't UUID= work with mount?
  3. Why are all those errors displayed?