[RFC] mount can figure out fstype automatically

Ivan Voras ivoras at fer.hr
Sat Jul 8 17:37:56 UTC 2006


Craig Rodrigues wrote:

> - I didn't want to build up a table of known superblocks
>   inside mount(8) because every time a new filesystem is
>   added to FreeBSD, mount(8) would need to be updated

There's a similar (in the basic idea, not in details) request on 
freebsd-geom list - how to detect what GEOM class is set up in an 
arbitrary provider. That is similar to this thread because both are 
discussing information that is available on-disk and usable by core 
system utilities (mount and installer) - so maybe a new library is in 
order, which will enable users to detect what is on a particular 
device/parition/provider/etc from on the device.

In case of GEOM classes, metadata is written on the last sector, and 
first few fields ("signature fields") are in common format for all 
classes, so it's easy to get what class "owns" the device without going 
into the details of its metadata.

Something like:
    struct devcontentinfo* get_provider_info(char *device_name);

where returned value will be an array of found "contents", with a "type" 
member (enum) describing what it is (GEOM class / file system / swap), a 
"name" member which holds the ASCII name of the found thing ("UFS", 
"GEOM_MIRROR"), and an additional "extended_name" which would contain 
details ("UFSv2", "GEOM_MIRRORv4"). For these examples instead of 
"extended_name" maybe a version field will be enough ("v4" for 
GEOM_MIRROR stands for fourth metadata layout version).



More information about the freebsd-current mailing list