NetBSD-Users archive

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

Re: Problem with gpt partitioning in NetBSD-5.0.2 amd64



In article <4BB50D9C.1030403%kerwien.homeip.net@localhost>,
Peter Kerwien  <peter%kerwien.homeip.net@localhost> wrote:
>
>
>On 04/01/2010 11:09 PM, Christos Zoulas wrote:
>> In article <4BB4FAE6.6030707%kerwien.homeip.net@localhost>,
>> Peter Kerwien  <peter%kerwien.homeip.net@localhost> wrote:
>>
>>   
>>> server1# gpt -v destroy sd0
>>> gpt: rsd0d: mediasize=4499999293440; sectorsize=512; blocks=8789061120
>>> gpt: unable to open device 'rsd0d': Invalid argument
>>>
>>>     
>> Can you ktrace it and see which system call fails (I guess open()) and with
>> what args?
>>   
>   289      1 gpt      RET   read 512/0x200
>   289      1 gpt      CALL  lseek(3,0,0x417bcdbfe00,0)
>   289      1 gpt      RET   lseek 4499999292928/0x417bcdbfe00
>   289      1 gpt      CALL  read(3,0x7f7ffd616400,0x200)
>   289      1 gpt      GIO   fd 3 read 512 bytes
>       "EFI
>PART\0\0\^A\0\\\0\0\0\"\M-L\M-)\M-]\0\0\0\0\M^?\M-g}\M-:\^B\0\0\0\
>        \^A\0\0\0\0\0\0\0\"\0\0\0\0\0\0\0\M-^\M-g}\M-:\^B\0\0\0\M-4\M-{\M-=\
>       
>\M-U\M^Q:\M-_\^Q\M^Q\M-n\0\^U\^W\v\M^L6\M-_\M-g}\M-:\^B\0\0\0\M^@\0\0\
>       

So it is finding something that looks like an EFI partition at the end
of the disk, but it is trashed, so when it does some consistency checks
later it dies. You can run a 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, 0x7f7ffd616400ULL, SEEK_SET) == (off_t)-1)
                err(1, "lseek");
        if (write(fd, buf, sizeof(buf)) == -1)
                err(1, "write");
        (void)close(fd);
        return 0;
}

to zap it! gpt is doing too many consistency checks :-)

christos



Home | Main Index | Thread Index | Old Index