#2704 Issue closed: Impossible to force command rear format /dev/disk/by-label/USB-KEY-FOO-BAR

Labels: support / question, fixed / solved / done

filoucrackeur opened issue at 2021-10-28 16:51:

all version

redhat enterprise linux 8

i can't do this , is Impossible to force command

rear format /dev/disk/by-label/USB-KEY-FOO-BAR

You need to tape manually YES

if will be great to add force or f option ?

rear format /dev/disk/by-label/USB-KEY-FOO-BAR -f or --force

i don't want to do something like

rear format /dev/disk/by-label/USB-KEY-FOO-BAR < echo YES

jsmeix commented at 2021-10-29 07:11:

rear -v format -- -f -y /dev/sdX

works for me to "format" the whole disk
(i.e. create partitioning and filesystems from scratch)
which is what "rear format" is meant for.

The "rear format" workflow has a somewhat special syntax
(that is caused by what getopt needs for nested getopt calls
because getopt is first called in rear and then in the format workflow)

# rear format help
ERROR: Argument 'help' not accepted. Use 'rear format -- --help' for more information.

# rear format -- --help
Use 'rear format [ -- OPTIONS ] DEVICE' like 'rear -v format -- --efi /dev/sdX'
Valid format workflow options are: -e/--efi -f/--force -y/--yes

Usually /dev/disk/by-label/* cannot work because those
labels usually mean filesystem labels so /dev/disk/by-label/*
are symlinks that point to partitions with filesystems
but "rear format" needs a whole disk device
so e.g. /dev/disk/by-id/* works for those /dev/disk/by-id/* symlinks
that point to a whole disk like for me

/dev/disk/by-id/usb-TOSHIBA_External_USB_3.0_20170521000273F-0:0 -> /dev/sdb

so also

rear -v format -- -f -y /dev/disk/by-id/usb-TOSHIBA_External_USB_3.0_20170521000273F-0:0

works for me.

I wonder what is wrong with providing the input a program needs at its stdin like

echo Yes | rear -v format /dev/sdX

which also works for me.

gdha commented at 2021-10-29 07:26:

@filoucrackeur Please stay polite in your posts.


[Export of Github issue for rear/rear.]