mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-12-08 00:00:12 +03:00
format: Do a 'udevadm trigger' after formatting
Some checks failed
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix Flake actions / nix-matrix (push) Has been cancelled
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Has been cancelled
Some checks failed
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix Flake actions / nix-matrix (push) Has been cancelled
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Has been cancelled
This causes the new filesystem UUID to be picked up; without this, mount can fail if it's a multidevice filesystem. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
e65dd86e41
commit
31c7a7398a
@ -480,6 +480,14 @@ int cmd_recover_super(int argc, char *argv[])
|
||||
if (args.yes || ask_yn())
|
||||
bch2_super_write(dev_fd, sb);
|
||||
|
||||
/*
|
||||
* Ensure that 'bcachefs mount' sees the newly formatted devices when
|
||||
* scanning by UUID in the udev database:
|
||||
*/
|
||||
CLASS(printbuf, udevadm_cmd)();
|
||||
prt_printf(&udevadm_cmd, "udevadm trigger --settle %s", dev_path);
|
||||
system(udevadm_cmd.buf);
|
||||
|
||||
if (args.src_device)
|
||||
printf("Recovered device will no longer have a journal, please run fsck\n");
|
||||
|
||||
|
||||
@ -357,6 +357,16 @@ struct bch_sb *bch2_format(struct bch_opt_strs fs_opt_strs,
|
||||
xclose(i->bdev->bd_fd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Ensure that 'bcachefs mount' sees the newly formatted devices when
|
||||
* scanning by UUID in the udev database:
|
||||
*/
|
||||
CLASS(printbuf, udevadm_cmd)();
|
||||
prt_str(&udevadm_cmd, "udevadm trigger --settle");
|
||||
darray_for_each(devs, i)
|
||||
prt_printf(&udevadm_cmd, " %s", i->path);
|
||||
system(udevadm_cmd.buf);
|
||||
|
||||
return sb.sb;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user