NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/53668: gpt(8) remove -L does exactly the wrong thing



>Number:         53668
>Category:       bin
>Synopsis:       gpt(8) remove -L removes all partitions EXCEPT the right one
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 14 19:30:01 +0000 2018
>Originator:     riz%NetBSD.org@localhost
>Release:        NetBSD 8.0
>Organization:
	
>Environment:
System: NetBSD cassava.tastylime.net 8.0 NetBSD 8.0 (GENERIC) #0: Tue Jul 17 14:59:51 UTC 2018 mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:

On a production NetBSD 8.0 box, I wanted to remove a gpt partition with a
particular label; I used 
gpt remove -L partition-to-remove wd0

...and it removed ALL PARTITIONS *except* the labeled one.

Here's me duplicating it with a vnd on a different NetBSD 8.0 box:

cassava:riz  ~> sudo gpt show -l vnd0
    start     size  index  contents
        0        1         PMBR
        1        1         Pri GPT header
        2       32         Pri GPT table
       34    10000      1  GPT part - first_part
    10034    10000      2  GPT part - second_part
    20034    10000      3  GPT part - third_part
    30034    10000      4  GPT part - fourth_part
    40034   983933         Unused
  1023967       32         Sec GPT table
  1023999        1         Sec GPT header
cassava:riz  ~> sudo gpt remove -L third_part vnd0
/dev/rvnd0d: Partition 1 removed
/dev/rvnd0d: Partition 2 removed
/dev/rvnd0d: Partition 4 removed
cassava:riz  ~> sudo gpt show -l vnd0
    start     size  index  contents
        0        1         PMBR
        1        1         Pri GPT header
        2       32         Pri GPT table
       34    20000         Unused
    20034    10000      3  GPT part - third_part
    30034   993933         Unused
  1023967       32         Sec GPT table
  1023999        1         Sec GPT header
cassava:riz  ~>

Boy, was this annoying.  Luckily, on the production machine I had just shown
all the partitions, so I was able to recreate them, but this could have
royally screwed up my day.
>How-To-Repeat:
	- create a gpt-partitioned disk with multiple labeled partitions.
	- use "gpt remove -L partition-to-remove" <disk>
	- watch it remove all OTHER partitions.
>Fix:
	none given.

>Unformatted:
 	


Home | Main Index | Thread Index | Old Index