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 <4BB51EC3.2050203%kerwien.homeip.net@localhost>,
Peter Kerwien  <peter%kerwien.homeip.net@localhost> wrote:
>Unfortunately I don't think it helped:
>
>server1# gcc -o zap_gpt zap_gpt.c 
>server1# ./zap_gpt                
>zap_gpt: write: Invalid argument
>server1# gpt -v destroy sd0       
>gpt: rsd0d: mediasize=4499999293440; sectorsize=512; blocks=8789061120
>gpt: unable to open device 'rsd0d': Invalid argument
>
>/Peter

My bad; cut and pasted the number from the wrong line!

christos

#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;
}



Home | Main Index | Thread Index | Old Index