summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2025-09-01bcachefs undumpKent Overstreet
Add our own version of 'qemu-img convert', which doesn't have the l1 table size limit or require fixing our missing reflink table. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-08-28Plumb subvol v2 ioctls with proper error messagesKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-08-27mount: try to mount even if module is not loadedNewbieOrange
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-08-27Commands called with no arguments now print usageKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-08-08device_scan now uses no_version_checkKent Overstreet
Fix a compatibility issue - old tools can now mount newer filesystems with incompatible features, even if they can't do anything else with them. cmd_show_super now uses no_version_check as well. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-08-02cmd_show_super: Look up and print names of member devicesKent Overstreet
bch2_sb_to_text_with_names(): print device paths and models of each member. Fixes: https://github.com/koverstreet/bcachefs/issues/801 Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-08-01get_or_split_cmdline_devs() now scans for component devicesKent Overstreet
Fix accidental splitbrain issues caused by writing to only some of a filesystem's devices: now, all subcommands that take member devices will scan for all members before opening. Fixes: https://github.com/koverstreet/bcachefs/issues/924 Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-08-01device_scan.rsKent Overstreet
Pull out the code for scanning for component devices into a separate module with a nicer interface. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-07-13Implement dump_stack()Kent Overstreet
Rust has this in the standard library - nice. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-07-06bcachefs recovery-passesKent Overstreet
New subcommand for scheduling or descheduling recovery passes on an unmounted filesystem. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-06-25mount: check if bcachefs module is loadedKent Overstreet
This lets us print out a more useful error. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-06-20cmd_image_createKent Overstreet
Add a tool for creating small image files. Data is written out in a reproducible order, sequentially from the start of the device. Metadata is initially written to a temporary device, then after writing out data, the metadata we want to keep (alloc info is left out by default) is migrated to the real device. Then, the image file is trimmed to minimum size and the temporary metadata device dropped. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-06-20cmd_strip_allocKent Overstreet
Add a command for stripping allocation info for a filesystem. This is primarily to test codepaths used by the new image creation tool. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-29Update bcachefs sources to 7f938192650f bcachefs: darray_find(), darray_find_p()Kent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-29cmd_list: Don't run any fsck/upgradesKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-07list: Allow for lookups within a particular snapshotKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-13Update bcachefs sources to 2f9361370129 bcachefs: Improve opts.degradedKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-27bcachefs-tools: make targets of subvolume create/delete requiredIntegral
Currently, when no targets are provided for "bcachefs subvolume create" or "bcachefs subvolume delete", it will exit silently with code 0. Make targets (arguments) required to solve this problem. This patch solves issue https://github.com/koverstreet/bcachefs/issues/766. Signed-off-by: Integral <integral@archlinuxcn.org> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-25mount: Parse bcachefs options, and pass them to mount helperKent Overstreet
This fixes the migrate test - we need to handle the sb=# option. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-21fix(key): replace c_str macro with `c""` literalThomas Mühlbacher
According to the MSRV in Cargo.toml, we can use this now. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-17cmd_recover_super: 'bcachefs recover-super'Kent Overstreet
New tool for scanning for backup superblocks, to recover when the primary superblock + sb layout have been overwritten. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-12-29Merge pull request #345 from Flowdalic/mount-print-errorkoverstreet
mount: print a helpful error message
2024-10-25Allow multiple targets for subvolume delete.Malte Schröder
Signed-off-by: Malte Schröder <malte.schroeder@tnxip.de> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-10-25mount: print a helpful error messageFlorian Schmaus
Just returning a failure exit status makes it hard to tell what the actual issue was. Instead, the mount command now also provides some textual output. See https://github.com/koverstreet/bcachefs-tools/issues/308 for an example where mount does not provide any helpful output, even with BCACHEFS_LOG=trace enabled. Signed-off-by: Florian Schmaus <flo@geekplace.eu>
2024-10-12cmd_mount: Change error message on -EBUSY to match util-linuxKent Overstreet
This causes xfstests generic/741 to pass Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-10-05Fix 'fuse' feature conditional compilationKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-09-29cmd_list: open with noxclKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-09-03Remove byteorder depJubilee Young
This requires something other than literally zero code to replace, but is another opportunity to deny packagers the fun of experimenting with replacing crate versions with incompatible patched crate versions.
2024-08-09mount: When mounting a single device, make sure we mount the device specifiedKent Overstreet
When mounting a multi device filesystem we have to scan for component devices from the UUID, but we don't want to scan if it's a single device filesystem; if the same filesystem is exposed via multiple device nodes (e.g. dm faulty testing), the scan can pick up the wrong node. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-08-02Merge pull request #320 from WhatAmISupposedToPutHere/masterkoverstreet
Ask for password via systemd-ask-password
2024-07-30fix: don't try to convert C command returns to u8Thomas Mühlbacher
Fixes Rust panics if some C command (like fsck) returns a value bigger than 255. The process exit code will be mangled but what can we do, it's less confusing than a panic (that unfortunately doesn't print the return value). Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-07-26mount: Ask for password via systemd-ask-passwordSasha Finkelstein
This would allow to supply the password via the plymouth password input. If systemd-ask-password does not exist or fails to start, falls back to the old-style password request. Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
2024-07-22mount: Fix UAF in option string handlingKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-21refactor: fix clippy lintThomas Mühlbacher
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-07-21style: nix fmtThomas Mühlbacher
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-07-21fix(logging): re-enable warn and error by defaultThomas Mühlbacher
Same as it was in most previous releases. Without this, you may not see any output for certain errors. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-07-21feat(logging): switch to custom file:line formatThomas Mühlbacher
This mostly tries to be similar to the default `env_logger` format but instead of using the more vague target in the log message, we instead put the file name and line number in the log. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-07-20Rename option commandsKent Overstreet
set-option -> set-fs-option setattr -> set-file-option Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-20mount: Fall back to read-only on -EROFSKent Overstreet
this is the mount helper's job, and since we're the mount helper... fixes: xfstests generic/050 Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-18mount: Close devices before doing mountKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-15logging: kill quiet optionv1.9.4Kent Overstreet
no logging by default, enabled with -v logging by default broke fstests Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-14fix silly clippy warningKent Overstreet
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-14mount: replace rpassword with rustix::termiosLauri Tirkkonen
because rpassword unconditionally open()s /dev/tty, it fails with ENXIO on the console without workarounds like busybox's cttyhack. in contrast, bcachefs unlock works fine on console, so change the passphrase prompt logic in mount to be closer to what it is in unlock. Signed-off-by: Lauri Tirkkonen <lauri@hacktheplanet.fi> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-29feat: use `ExitCode` over `std::process:exit()`Thomas Mühlbacher
Should provide us with better outputs on process failure, also makes unwinding better and is generally recommended over `exit()`. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-28feat: add `--quiet` cli argumentThomas Mühlbacher
To silence log outputs on the CLI. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-28feat: use env_loggerThomas Mühlbacher
Instead of the custom logger impl, which limits the features we can easily provide for users. This introduces the `BCACHEFS_LOG` environment variable for setting the log verbosity. Setting `BCACHEFS_LOG=trace`, e.g. in a test environment, will yield all log messages. Also I think it's reasonable to print INFO level logs by default. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-26feat(key): make `UnlockPolicy::Fail` more usefulThomas Mühlbacher
We already can check if an fs is encrypted with `bcachefs unlock -c`. With this option we can now instead check if we have a key but not actually mount by not specifying a mount point. e.g. ```sh if bcachefs mount -k fail "$blkdev"`; then echo "device is unlocked!" fi ``` Not sure what the original intent for this was. For scenarios where encryption is simply not supported on principle? Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-26refactor(key): split up unlocking functionsThomas Mühlbacher
This is more similar to the existing C code, which is already in nice small chunks. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-26refactor: simplify branches for parsing devThomas Mühlbacher
Less repetition and no nested if/else. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-26feat(mount): make unlock policy optional/explictThomas Mühlbacher
This changes the semantics of some arguments related to unlocking and slightly changes the unlocking logic. Also update help formatting/text. Instead of defaulting to `UnlockPolicy::Ask`, the argument becomes optional. That means if it is specified, the user really wants that specific policy. Similar to how `passphrase_file` also works. This also extends `UnlockPolicy` to override `isatty` detection. Fixes: #292 Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>