fdisk: warn if disk in use

Fixes: https://github.com/karelzak/util-linux/issues/1278
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2021-04-15 14:43:15 +02:00
parent d527e8cf70
commit dee0c29c6f
1 changed files with 6 additions and 0 deletions

View File

@ -1140,6 +1140,12 @@ int main(int argc, char **argv)
if (rc)
err(EXIT_FAILURE, _("cannot open %s"), devname);
if (fdisk_device_is_used(cxt))
fdisk_warnx(cxt, _(
"This disk is currently in use - repartitioning is probably a bad idea.\n"
"It's recommended to umount all file systems, and swapoff all swap\n"
"partitions on this disk.\n"));
fflush(stdout);
if (!fdisk_is_readonly(cxt)