1

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

6
  • I think a bit more context is needed. For me (add the file command) MBR = Master Boot Record. Why would you care to see the MBR in a human readable form?
    – heavyd
    Dec 1, 2014 at 22:07
  • I am reading about MBR and naturally I would like to inspect it myself. The problem is that on several places is mentioned to use 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...
    – ps-aux
    Dec 1, 2014 at 22:19
  • The only thing 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
    – Nifle
    Dec 1, 2014 at 22:46
  • The MBR wikipage was surprisingly informative IMO
    – Nifle
    Dec 1, 2014 at 22:48
  • Why do you think MBR cannot be translated into normal table by a program? This is one of the links where this trick is mentioned: miljan.org/main/2007/09/05/easy-way-to-read-mbr
    – ps-aux
    Dec 1, 2014 at 22:49

3 Answers 3

1

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).

0

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

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .