I'm trying to create a NetBSD image to be used on my opennebula cloud, and for its contextualization I need to look for a disk labeled "CONTEXT", in fact it is a cdrom, usually on debian I would look for it on /dev/disk/by-label, but in NetBSD the story seems to be different, and I tried to use disklabel but I have found only the "fictitious" label on the cdrom: NetBSDImage# disklabel /dev/cd0 # /dev/cd0d: type: ATAPI disk: iso partition label: fictitious flags: removable bytes/sector: 2048 sectors/track: 100 tracks/cylinder: 1 sectors/cylinder: 100 cylinders: 2 total sectors: 181 rpm: 300 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # microseconds track-to-track seek: 0 # microseconds drivedata: 0

4 partitions: # size offset fstype [fsize bsize cpg/sgs] a: 181 0 ISO9660 0 # (Cyl. 0 - 1*) d: 181 0 UDF # (Cyl. 0 - 1*) disklabel: boot block size 0 disklabel: super block size 0 disklabel: partitions a and d overlap

I do not understand how can I do the same on NetBSD, checking if there is any disk named "CONTEXT" to mount it. The plan B is just to mount the cdrom if it is available and check if there is a file called context.sh but I would prefer to do it the right way, by checking the disk name.


You can use the file(1) command on the CD-ROM device.

For example, I have a NetBSD 7 iso in my CD-ROM drive:

$ sudo file -s /dev/cd0d
/dev/cd0d: # ISO 9660 CD-ROM filesystem data 'NETBSD_70_BETA' (bootable)

The Volume ID here is 'NETBSD_70_BETA'

You can also install isoinfo from pkgsrc (sysutils/cdrtools) and sed/grep the data you need:

$ sudo isoinfo -d -i /dev/cd0d
CD-ROM is in ISO 9660 format
System id: NetBSD
Volume id: NETBSD_70_BETA
Volume set id: 

More info can be found in the wiki.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.