ms-sys


Quick favorite links: Documentation FAQ Download Contact

About

This is a Linux program for writing Microsoft compatible boot records. The program does the same as Microsoft "fdisk /mbr" to a hard disk or "sys d:" to a floppy or FAT partition except that it does not copy any system files, only the boot record is written.

License

This program is published under the terms of the GNU GENERAL PUBLIC LICENSE (GPL).

Documentation

From the README:

1. General
----------

This program is used to create Microsoft compatible boot records. It is able
to do the same as Microsoft "fdisk /mbr" to a hard disk. It is also able to
do the same as Microsoft "sys d:" to a floppy or FAT partition except that
it does not copy any system files, only the boot record is written.
Specifications of boot records is taken from
http://www.geocities.com/thestarman3/asm/mbr/MBR_in_detail.htm

The program is useful when using Linux to restore a backup of a reference
Microsoft Windows installation.

2. Installation
---------------

Step 1, unpack the archive:

tar -xzvf ms-sys*.tgz

Step 2, compile:

cd ms-sys
make

Step 3, become root and install

su (and give password)
make install

3. Examples
-----------

Please note that Windows ME is not useful for making standalone bootable
floppies. However, Win9x and DOS works fine with example 1 and example 3.

Example 1, creating a 1.68 MB bootable floppy:
This example assumes that you have your windows installation mounted at /dosc
and also have mtools and fdformat installed.

fdformat /dev/fd0u1680
mformat a:
ms-sys -w /dev/fd0
mcopy /dosc/io.sys a:
mcopy /dosc/msdos.sys a:
mcopy /dosc/command.com a:


Example 2, restoring a backup to a fresh hard disk:

Step 1, use GNU parted to create your FAT32 partition and file system:

parted (then create partition and file system)

Step 2, write the MBR:

ms-sys -w /dev/hda

Step 3, write the FAT32 partition boot record:

ms-sys -w /dev/hda1

Step 3b, write partition info and drive id to partition:

ms-sys -p /dev/hda1

This step might be needed depending on which program was used to format the
partition. If the program was formatted with gnu parted this step could be
skipped. It is also possible to combine this flag with the previous step
like this: ms-sys -wp /dev/hda1

Step 4, mount your new filesystem:

mount /dev/hda1 /mnt

Step 5, read your backup

cd /mnt; tar -xzvf /path/to/my_windows_backup_file.tgz


Example 3, creating a bootable 2.8 MB floppy image for use with an el-torito
bootable CD:

dd if=/dev/zero of=floppy288.img bs=1024 count=2880
/sbin/mkdosfs floppy288.img
ms-sys -1 -f floppy288.img
su
mount -o loop floppy288.img /mnt
cp msdos.sys /mnt/
cp io.sys /mnt/
cp command.com /mnt/
(it might also be a good idea to add a config.sys and autoexec.bat with
 CDROM support)
umount /mnt
exit
cp floppy288.img cd-files/eltorito.img
mkisofs -b eltorito.img -c eltorito.cat -o cdimage.iso cd-files
(burn the file cdimage.iso to a CD with cdrecord or another program)

4. Documentation
----------------

There is a man-page for ms-sys, and you will get some help by typing:

ms-sys --help

5. Known problems
-----------------

There have been reports about unbootable FAT32 partitions created with
"mformat -F c:". One workaround is to use gnu parted to create the
partition instead. Since version 1.1.3 ms-sys has the switch -p which
is supposed to fix this problem. The problem has also been reported on
partitions formatted with mkdosfs and mkfs.vfat.

There have been yet another problem reported about the -p switch and gnu
parted together with Linux kernel 2.6. The problem is that kernel 2.6 might
report a geometry incompatible with other operating systems. There is a
detailed description of the problem at
http://groups-beta.google.com/group/linux.kernel/msg/404d8683ce302cf2
As a workaround for this ms-sys now has the switch -H to manually set the
number of heads. The next problem is to find out what value for number of
heads to give. If the system was booted by LILO this can be shown by
"lilo -T geom".

There have been reports about problems when compiling against uClibc. More
problem reports or suggestions of fixes are welcome!

Writing Windows 7 NTFS boot records with ms-sys is probably not useful if
the intention is to get a bootable partition.
	    

FAQ

Q1: I followed all instructions but my system doesn't boot!?

A1: This is most likely because you are running ms-sys in a Linux environment
    with a 2.6 kernel. The problem is that kernel 2.6 might report a geometry
    incompatible with other operating systems. This makes gnu parted write
    incompatible geometry information when formatting the partition. Ms-sys
    has the switch -p which is supposed to fix the geometry information when
    the formatting program has failed writing this correctly, but also ms-sys
    will write the wrong information for the same reason. This is a known
    problem described in the README which also contains a link to a detailed
    description and a possible workaround for the problem.
	    

Screenshot

Usage:
	ms-sys [options] [device]
Options:
    -1, --fat12     Write a FAT12 floppy boot record to device
    -2, --fat32nt5  Write a FAT32 partition NT5.0 boot record to device
    -8, --fat32nt6  Write a FAT32 partition NT6.0 boot record to device
    -x, --exfatnt6  Write a EXFAT partition NT6.0 boot record to device
    -e, --fat32pe   Write a FAT32 partition PE boot record to device
    -3, --fat32     Write a FAT32 partition DOS boot record to device
    -4, --fat32free Write a FAT32 partition FreeDOS boot record to device
    -5, --fat16free Write a FAT16 partition FreeDOS boot record to device
    -6, --fat16     Write a FAT16 partition DOS boot record to device
    -n, --ntfs      Write a NTFS partition Windows 7 boot record to device
    -o, --fat16ros  Write a FAT16 partition ReactOS boot record to device
    -c, --fat32ros  Write a FAT32 partition ReactOS boot record to device
    -q, --fat32kos  Write a FAT32 partition KolibriOS boot record to device
    -l, --wipelabel Reset partition disk label in boot record
    -p, --partition Write partition info (hidden sectors, heads and drive id)
                    to boot record
    -H, --heads <n> Manually set number of heads if partition info is written
    -B, --bps <n>   Manually set number of bytes per sector (default 512)
    -O, --writeoem <s>   Write OEM ID string <s> to file system
    -S, --writewds <x>   Write Windows Disk Signature hexadecimal <x> to MBR
    -7, --mbr7      Write a Windows 7 MBR to device
    -i, --mbrvista  Write a Windows Vista MBR to device
    -m, --mbr       Write a Windows 2000/XP/2003 MBR to device
    -9, --mbr95b    Write a Windows 95B/98/98SE/ME MBR to device
    -d, --mbrdos    Write a DOS/Windows NT MBR to device
    -s, --mbrsyslinux    Write a Syslinux MBR to device
    -t, --mbrgptsyslinux Write a Syslinux GPT MBR to device
    -a, --mbrreactos     Write a ReactOS MBR to device
    -k, --mbrkolibrios   Write a KolibriOS MBR to device
    -r, --mbrrufus  Write a Rufus MBR to device
    -g, --mbrgrub4dos    Write a Grub4Dos MBR to device
    -b, --mbrgrub2  Write a Grub 2 MBR to device
    -z, --mbrzero   Write an empty (zeroed) MBR to device
    -f, --force     Force writing of boot record
    -h, --help      Display this help and exit
    -v, --version   Show program version
    -w, --write     Write automatically selected boot record to device

    Default         Inspect current boot record

Warning: Writing the wrong kind of boot record to a device might
destroy partition information or file system!
	    

Changelog

From the CHANGELOG:

Date       Version  Comment
---------------------------------------------------------------------------
 8/10 2022 2.8.0    No changes, only marked as stable version.

28/6  2020 2.7.0    Compressing man-page with gzip --no-name for
                    reproducibility.
                    Added support to run on macOS/OS X
                    Added NT6.0 FAT32 boot record (Win7/8/10)
                    Added NT6.0 EXFAT boot record (Win8/10)
                    Updated partition information feature for EXFAT and
                    NTFS and also enabled missing FAT16 support.
                    Added X/Open7 POSIX.1-2008 definition to prevent
                    compile warnings in identify.c and exfat.c source
                    code caused by the fileno function.
                    Removed support to alter OEM ID of NTFS boot records
                    since this makes for an unmountable partition.
                    Fixed error in Makefile where debug build didn't work.
                    Changed Makefile to support install on Mac/BSD/Linux.
                    Updated french, german and swedish man pages.
                    Updated french, german and swedish po files.
                    Improved partition device and start sector detection on
                    FreeBSD. Implemented full support for OpenBSD by adding
                    missing code for disk and partition information detection
                    and enabled smart select which wasn't functional.


17/3  2019 2.6.0    No changes, only marked as stable version.

27/2  2016 2.5.3    Added french man page and translation.

16/1  2016 2.5.2    Added german man page,
                    added support for Grub2 and Grub4Dos MBR,
                    added support for KolibriOS MBR and FAT32 boot record,
                    added support for ReactOS MBR, FAT32 and FAT16 BR,
                    added support for Rufus MBR,
                    added experimental support for large sectors ( > 512),
                    now possible to alter OEM ID of FAT and NTFS boot records.
                    now possible to alter Windows Disk Signature in MBR.

26/9  2015 2.5.1    Added support to run on OpenBSD,
                    added german translation.

 5/1  2015 2.5.0    Added support to run on FreeBSD.

 1/1  2015 2.4.1    Added support for FAT32 PE boot record.

24/5  2014 2.4.0    Added support for syslinux GPT MBR.
                    Updated syslinux mbr to version 6.02.

 1/4  2012 2.3.0    Added experimental support for NTFS boot record. This
                    functionality is mostly useful to identify Windows 7 NTFS
                    boot records. Writing an NTFS Windows 7 boot record will
                    most likely not be of much use.

22/1  2011 2.2.1    Modified Makefile to recreate directories lost by CVS
                    Now also doing a sanity check before only writing BPB

13/5  2010 2.2.0    Added support for large disk image files. This version
                    is now considered stable as the BPB problem has had a
                    workaround since version 2.1.5.

14/3  2010 2.1.5    Added support for manually setting the number of heads
                    in BPB

3/10  2009 2.1.4    Win 7 and Vista MBR added
                    Added copyright notice to source files

30/12 2007 2.1.3    Makefile now supports DESTDIR

20/11 2005 2.1.2    Corrected spelling of Gürkan Sengün in man-page and
                    CONTRIBUTORS file.
                    Added a FAQ.
                    Renamed sv_SE.po to sv.po to fix bug described at
                    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=336813
                    FreeDOS FAT16 and FAT32 boot records added.

3/8  2005  2.1.1    Now the -p switch also writes the number of heads in BPB.
                    Modified Makefile to work with newer version of gcc.
                    Unfortunately it no longer works with older versions of 
                    gcc as the output from the switch -MM has changed.

26/6 2005  2.1.0    Now ms-sys is able to identify an ms-dos MBR with the
                    undocumented F2 instruction.
                    Fixed bug in Makefile which make Makefile fail to install
                    files unless target directories already exists.

5/6  2004  2.0.0    Now ms-sys should compile cleanly also with a 2.6 Linux
                    kernel based distribution.

21/3 2004  1.1.3    Added switch -p to write needed partition information
                    which might be missing when some format programs are
                    used. The program now supports command line switch
                    concatenation, i e "ms-sys -f2 file" instead of
                    "ms-sys -f -2 file".

16/2 2004  1.1.2    Unofficial contributed version with support for new
                    MBRs and better MBR recognition. Instead of completing
                    the work to make this an official release I choose to
                    merge it into my ongoing work.

4/1  2004  1.1.1    Now compiles even if libintl.h is missing
                    Replaced the -k switch with -l (--wipelabel) with the
                    inverted functionality. This functionality was also
                    implemented for FAT12 and FAT16.

20/9 2003  1.1.0    DOS FAT16 boot record added
                    NT FAT32 boot record added

23/2 2003  1.0.2    Documentation update, man-page added

9/8 2002   1.0.1    Fixed problem compiling sv_SE.po with newer versions of
                    msgfmt

4/8 2002   1.0      First public release. Documentation updated with
                    SourceForge addresses for web and email contact.

30/7 2002  0.9      First stable release
	    

ToDo

From the TODO:

This might be done for future releases:

1. Add boot records for other file systems and OSes, NT FAT16? IBM PC-DOS?
   To do this I will need documentation and someone willing to test the new
   features.

2. Add more translations, contributions are welcome!
	    

Download

Current version

Current stable version is 2.8.0, it is available from SourceForge download. The md5sum of ms-sys-2.8.0.tar.gz is 04972244c4a31718abf1c69779ccc31b

Older versions

Version is 2.7.0 is available from SourceForge download. The md5sum of ms-sys-2.7.0.tar.gz is 6c895ab03664218aae0915b0fa537322

Version 2.6.0 is available from SourceForge download. The md5sum of ms-sys-2.6.0.tar.gz is 1bfd8f431268d8ae0cf1fa2f79efdc27

Version 2.5.3 is available from SourceForge download. The md5sum of ms-sys-2.5.3.tar.gz is a33f0ca96d0ba2688503183b74a86568

Version 2.5.2 is available from SourceForge download. The md5sum of ms-sys-2.5.2.tar.gz is b663cc89a0a1c29e67ca355d687b0a96

Version 2.5.1 is available from SourceForge download. The md5sum of ms-sys-2.5.1.tar.gz is c66fb9045543559d3b320f57d4c87f30

Version 2.5.0 is available from SourceForge download. The md5sum of ms-sys-2.5.0.tar.gz is dfd50499ae950a92290d0d3c577e031b

Version 2.4.1 is available from SourceForge download. The md5sum of ms-sys-2.4.1.tar.gz is d31e7ef3db6bd77dbb13df11057fa0f2

Version 2.4.0 is available from SourceForge download. The md5sum of ms-sys-2.4.0.tar.gz is 6742dd1a058b1ce32cb991853d9d6bec

Version 2.3.0 is available from SourceForge download. The md5sum of ms-sys-2.3.0.tar.gz is 46d186707c7767db664afe681f8eaad6

Version 2.2.1, is available from SourceForge download. The md5sum of ms-sys-2.2.1.tar.gz is 659fb46f1b014abe64ae7d635c5bc1f8

Version 2.2.0 is available from SourceForge download. The md5sum of ms-sys-2.2.0.tar.gz is aed171c3b354e7c755e1b9fd9bd8c384

Version 2.1.5 is available from SourceForge download. The md5sum of ms-sys-2.1.5.tar.gz is 2acdaea25accc821bd033083d0befdcc

Version 2.1.4 is available from SourceForge download. The md5sum of ms-sys-2.1.4.tar.gz is 2bea17d08d02494fe36fd574d0731d93

Version 2.1.3 is available from SourceForge download. The md5sum of ms-sys-2.1.3.tgz is 6fad0a69ac89440ad4f696dbbbf11497

Version 2.1.2 is available from SourceForge download. The md5sum of ms-sys-2.1.2.tgz is 1a4195b7ed949d1da225615ab5e125cc.

Version 2.1.1 is available from SourceForge download. The md5sum of ms-sys-2.1.1.tgz is 99f822a9a281466411a082b0d706650e.

Version 2.1.0 is available from SourceForge download. The md5sum of ms-sys-2.1.0.tgz is aafbb0b56fdd0d31e660d644856c1690.

Version is 2.0.0, is available from SourceForge download. The md5sum of ms-sys-2.0.0.tgz is 1600f93cca31a610737d98f5e8510917.

Version 1.1.3 is available from SourceForge download. The md5sum of ms-sys-1.1.3.tgz is 85ea2c3c1053dc65db614de22cd280b1.

Version 1.1.1 is available from SourceForge download. The md5sum of ms-sys-1.1.1.tgz is b25279d7dec4d9bd2b2049697833d18e.

Version 1.1.0 is available from SourceForge download. The md5sum of ms-sys-1.1.0.tgz is 2fe1e98fc8975c7e3c125eca8e9a78b9.

Version 1.0.2 is available from SourceForge download. The md5sum of ms-sys-1.0.2.tgz is d98d06a85f3c4821fdda8f62cae4559d.

Version 1.0.1 is available from SourceForge download. The md5sum of ms-sys-1.0.1.tgz is 760ef05f49eba5c13aa4f392188def03.

Version 1.0 is available from SourceForge download. The md5sum of ms-sys-1.0.tgz is 81223ed3c366d2b7e5b6e21d9d2d769a.

Version is 0.9 is available from SourceForge download. The md5sum of ms-sys-0.9.tgz is 64d02dfa946744bb30b25de935358c91.

Links

Documentation
Boot Records Revealed! Mirror of lost good reference page
Boot Records Revealed! Another US mirror of the lost site above
Boot Records Revealed! Russian mirror of the site above
Programs
GNU Parted Useful for creating partitions and file systems.
regutils Useful for manipulating the windows registry files.
cabextract Useful for extracting windows .cab-packages
ms-sys-free A close following fork of ms-sys which only supports boot records of free operating systems.
Other links
BG-Rescue Linux A rescue disk containing ms-sys among other tools
PLD RescueCD A rescue CD containing ms-sys among other tools
Trinity Rescue Kit A rescue CD containing ms-sys among other tools, good antivirus CD.
SourceForge ms-sys SourceForge page

Contact

Bug reports

Bugs should be reported to the SourceForge Bug Tracking System.

Feature requests

With my limited time to spend I make no promises, but requests for new features can be posted at SourceForge ms-sys feature request page. To implement a new boot record I need time, documentation and someone willing to test the new boot record.

Patches

If you wish to provide your own patch to fix a bug or implement a new feature those patches can be sent to SourceForge ms-sys patches page.

Support

Questions will be answered at SourceForge ms-sys support page.

Email

It was once possible contact me, Henrik Carlqvist, by my SourceForge email. Unfortunately that email address is no longer usable because large amounts of spam. The only way to contact me are by the SourceForge links above.

During April 2011 many spam posts were made to the bugtracker. Since then it is no longer possible to make anonymous posts. An account at SourceForge is now required to post a bug report, feature request, patch or support request. It is possible to get a SourceForge account without having any own project hosted at SourceForge. Even though SourceForge kindly provides accounts and other services for free I realize that having to create an account to post a bug report or patch will be considered an obstacle by many and I apologize for any inconvenience.


Hosted by:
SourceForge Logo