I have MBR data in file and I would like to inspect it. Which Linux command can do this? WHen I ran
file mbr.file
the output was only mbr: DOS/MBR boot sector
Make sure you have the latest version of file
(the MBR stuff was added in 2007... but there were some updates in 2013 that perhaps are affecting you). Either ensure all your software is up to date from your distributions' repository, or grab the latest version of file
from https://github.com/file/file/ and build it.
The filesystems
magic pattern is what you are interested in, by the way: https://github.com/file/file/blob/master/magic/Magdir/filesystems. While theoretically you could download that and specify it to file -m
, the format of that file may not be compatible with older versions of file
.
If all you're trying to do is view the MBR of a particular device, though (rather than MBR data stored in a file), you can just view the MBR directly with e.g. parted
or fdisk
(just be careful to not modify anything).
The file
command works by using data/templates from a file /etc/magic
†. It seems your Linux/Unix system has a different /etc/magic
and/or file
than the author of that article.
You could try updating or just use a hex dump utility, a calculator and a description of the MBR organisation.
† it can be elsewhere, e.g. in /usr/share/*/magic
- if in doubt try locate magic
or sudo find / -name magic
If you want to view a partition table ( and that's what an MBR is ), then you use a partitioning tool, such as fdisk
or parted
.
file
command) MBR = Master Boot Record. Why would you care to see the MBR in a human readable form?file
command to display human readable form of MBR but it does not work on openSUSE 13.2. I wonder if there is some command option which I overlook in manual page or something...file
does is to tell you what type of file it is. Read it's man page again. And I highly doubt a MBR would not have a human readable form. My best suggestion is read the specs+code for creating/reading a MBR and use a hex-editor