Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 May 2006 23:15:11 +0200
From:      Viktor Vasilev <viktor.vasilev@stud.tu-darmstadt.de>
To:        freebsd-geom@freebsd.org
Subject:   modifying the MBR through geom_mbr
Message-ID:  <200605202315.11558.viktor.vasilev@stud.tu-darmstadt.de>

next in thread | raw e-mail | index | archive | help
Hi,

I've been looking at the fdisk code while porting gnu parted to freebsd and 
I'm confused, and don't know what the right way to update the MBR is.
Currently the code uses the same gctl's as fdisk.c:write_disk() and 
gctl_issue returns "Geom not found". I've dug a little and it seems that 
this message is produced by sys/geom/geom_ctl.c:gctl_get_geom(), because 
the geom name wasn't found in the list. So it seems it'll never succeed at 
modifying the MBR of ad6 like this:

  grq = gctl_get_handle();
  gctl_ro_param(grq, "verb", -1, "write MBR");
  gctl_ro_param(grq, "class", -1, "MBR");
  gctl_ro_param(grq, "geom", -1, "ad6");
  gctl_ro_param(grq, "data", ssize, mbr_buf);
  ...

Another clue gave me the output of the kern.geom.conftxt sysctl:

  $ sysctl -b kern.geom.conftxt
  0 DISK ad6 251000193024 512 hd 16 sc 63
    ^^^^
  0 DISK ad0 203927027200 512 hd 16 sc 63
  1 MBR ad0s4 83914306560 512 i 3 o 120006835200 ty 165
  2 BSD ad0s4c 83914306560 512 i 2 o 0 ty 0
  2 BSD ad0s4a 83914298368 512 i 0 o 8192 ty 0
  1 MBR ad0s3 79999073280 512 i 2 o 40007761920 ty 165
  2 BSD ad0s3c 79999073280 512 i 2 o 0 ty 0
  2 BSD ad0s3a 79999065088 512 i 0 o 8192 ty 0
  1 MBR ad0s2 19041523200 512 i 1 o 20966238720 ty 12
  1 MBR ad0s1 20966206464 512 i 0 o 32256 ty 165
  2 BSD ad0s1f 16671239168 512 i 5 o 4294967296 ty 7
  2 BSD ad0s1e 1073741824 512 i 4 o 2147483648 ty 7
  2 BSD ad0s1d 1073741824 512 i 3 o 1073741824 ty 7
  2 BSD ad0s1c 20966206464 512 i 2 o 0 ty 0
  2 BSD ad0s1b 1073741824 512 i 1 o 3221225472 ty 1
  2 BSD ad0s1a 1073741824 512 i 0 o 0 ty 7

So, there isn't a geom with name "ad6" from the MBR class? How would I 
commit a new MBR to ad6 then?
Any ideas and explanations are welcome!


Cheers,
Vik
-- 
PGP Key: 0xE09DC8D8/6799 4011 EBDE 6412 05A1 090C DBDF 5887 E09D C8D8
Signed/encrypted mail welcome!



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605202315.11558.viktor.vasilev>