NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
port-amd64/43105: Destroying a GPT partition with dd will cause gpt destroy / create to fail
>Number: 43105
>Category: port-amd64
>Synopsis: Destroying a GPT partition with dd will cause gpt destroy /
>create to fail
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: port-amd64-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Apr 02 11:55:00 +0000 2010
>Originator: Peter Kerwien
>Release: NetBSD 5.0.2_PATCH
>Organization:
>Environment:
NetBSD server1 5.0.2_PATCH NetBSD 5.0.2_PATCH (GENERIC) #0: Sat Mar 27 17:55:16
UTC 2010 root@server1:/usr/obj/sys/arch/amd64/compile/GENERIC amd64
>Description:
When I created a large disk array, and tried to add a gpt partition it failed
to destroy/create a GPT label:
server1# gpt -v destroy sd0
gpt: rsd0d: mediasize=4499999293440; sectorsize=512; blocks=8789061120
gpt: unable to open device 'rsd0d': Invalid argument
The reason for this (According to Christos Zoulas, thx for all help!) is that I
destroyed a GPT partition with dd, the trailing GPT copy will not be able to
get validated leading to inability to remove/add a new GPT label.
I had to zap it with the help of some small program:
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <err.h>
int
main(void)
{
static char buf[0x200];
int fd = open("/dev/rsd0d", O_RDWR);
if (fd == -1)
err(1, "open");
if (lseek(fd, 0x417bcdbfe00ULL, SEEK_SET) == (off_t)-1)
err(1, "lseek");
if (write(fd, buf, sizeof(buf)) == -1)
err(1, "write");
(void)close(fd);
return 0;
}
Then I managed to execute gpt destroy / created on sd0 to create a new GPT
partition again.
For more information, see the following thread:
http://mail-index.netbsd.org/netbsd-users/2010/03/30/msg005937.html
>How-To-Repeat:
1. Destroy a GPT partition with dd.
2. Try to destroy / create a new label with:
# gpt destroy sd0
or
# gpt create sd0. Will result in:
gpt: unable to open device 'rsd0d': Invalid argument
>Fix:
Zap the trailing EFI partition at the end of the disk.
Home |
Main Index |
Thread Index |
Old Index