Fix ext2 magic

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
Nuvola apps important.png 

Ensure you only run the tool on the right partition(s) which really need to be fixed.

Also, only use fix_ext2_magic on stock partitions for the LS1, LS2, LS-HG and LS-HS.

Do not use on LSPro or later models.


fix_ext2_magic is a tool which corrects the LinkStation file system magic number.

In order to thwart hacking the LinkStation Buffalo decided to fiddle with the identifier (magic number) which identify the type of the file system on the hard disk partitions. Of course that didn't really thwart hacking :-), but creates a useless minor annoyance when someone wants to access the data on an LS hard drive on a normal Linux system.

The LS uses the common Linux file system ext2. However Buffalo swapped the bytes of the magic number. The file system driver on the LinkStation has been altered by Buffalo to deal with the mangled magic number, while of course this hasn't happen on normal Linux Systems. So when someone tries to connect the hard disk to a normal Linux system a normal Linux can't identify the file system and can't mount it.

This is where fix_ext2_magic comes into play. It replaces the magic number of a partition to the correct ext2 value. After this had been done, the partition can be mounted normally on any Linux system.


Download fix_ext2_magic


After unpacking the tool is run by specifying the partition which should be fixed to have a standard ext2 magic number:

./fix_ext2_magic --fix /dev/hd=

or, to fix back to Buffalo magic number

./fix_ext2_magic --fixback /dev/hd=

Where = stands for the partition which should be fixed. For example, a1 or a4.

Note that this command needs to be run as root, so you may need to add "sudo" in front of the command, i.e.

sudo ./fix_ext2_magic --fix /dev/hd=

NOTE: The exact partition to fix depends on how the drive is physically connected (to which IDE controller). Do not just use the partitions as given in the example. You are supposed to know what you are doing before running fix_ext2_magic.

CAUTION: Use only on stock IDE partitions that are created by the LSUpdater.exe program. Do not use on LSPro, LSLive or any ARM9-based device partitions.