netbsd-embed...@gmx.com ("Don NetBSD") writes:

>My understanding is that the 'd' partition is intended to reference the entire 
>medium.  But, a simple test (disklabel -e) indicates that I can create an 
>arbitrary (start,size) for that partition.  So, I could potentially encounter 
>a foreign disk that happens to *look* like it has a 'd' partition that doesn't 
>map to the actual entire physical disk.

The 'd' partition is the raw partition (on x86, other architectures use 'c'). 
Accesses to the raw
partition ignore the disklabel values.

N.B. 'sysctl kern.rawpartition' shows what the raw partition is 
(0='a',1='b',2='c',..).


>How can I get the actual geometry and ensure any bogus label contents are 
>obliterated (i.e., overwriting the entire medium regardless of the "protected" 
>MBR/label space)?

The disklabel stores the physical geometry, but that's mostly what has been 
stored in the on-disk
disklabel. The driver also knows the geometry from the drive itself. You can 
query this data using
'drvctl -p'.

Erasing an on-disk label is done with 'disklabel -D'. The kernel will then use 
a generated default
label.


>Related but different question:  is there any support for hot-plugging 
>(unplugging) drives (other than USB) on NetBSD?  I know you can kludge this 
>with external SCSI drives if the i/f is quiescent and you then rescan the 
>appropriate scsibus.  But, how does SATA/SAS cope?

About the same. There is an autoconfig feature in the drivers to 'rescan' which 
can be triggered
with 'drvctl -r'. ATA needs an additional parameter, i.e. 'drvctl -r -a ata_hl 
atabus1' will try
to attach drives on 'atabus1'. For hotplug you would first detach the old drive 
with 'drvctl -d'
and then rescan.

-- 
-- 
                                Michael van Elst
Internet: mlel...@serpens.de
                                "A potential Snark may lurk in every tree."

Reply via email to