I have a user which having problem after removing CentOS partition (using partition manager) in a dual boot PC with Windows Vista. The problem rise after that and Windows Vista simply unable to boot due to missing MBR. Since I have no Windows Vista installation disc anymore with me, I need to use some other way in order to fix the MBR.
Luckily I have the Ubuntu Live CD ISO which I have downloaded several days ago. The idea is boot into LiveCD, use a tool called ms-sys in Ubuntu and fix the MBR right away.
1. Get Ubuntu Desktop Live CD from Ubuntu download page here: http://www.ubuntu.com/download.
2. Download UNetbootin from here. We will use this application to burn our ISO into flash drive.
3. Prepare our flash drive. Format it to FAT32 file system. Since I am using Windows 7, just right click to the drive and click ‘Format’.
4. Launch UNetbootin and select ‘Diskimage’. Locate the ISO file in your PC and click OK as screenshot below:
5. Download ms-sys from http://ms-sys.sourceforge.net/ . I will the most stable version which is 2.2.1. Extract it and put it into the flash drive together with the Ubuntu Live CD as screenshot below:
6. Now we have enough tools to start the recovering process. Go to the problematic PC and boot from USB. Select “Try Ubuntu without installing” and make sure Ubuntu Live CD is booted up until the desktop page.
7. Open terminal. Go to Dashboard icon and type “terminal” to open it. We need to copy ms-sys directory into the local disk and build it:
$ cp /cdrom/ms-sys ~ -Rf $ cd ~/ms-sys $ sudo make
8. Run following command to analyze your disk partition:
$ sudo fdisk -l | grep /dev Disk /dev/sda: 160.0 GB, 160041885696 bytes /dev/sda1 16 12288527 6144256 12 Compaq diagnostics /dev/sda2 * 12288528 96175455 41943464 7 HPFS/NTFS/exFAT /dev/sda3 96175456 312577823 108201184 7 HPFS/NTFS/exFAT Disk /dev/sdb: 4007 MB, 4007657472 bytes /dev/sdb1 * 128 7827455 3913664 b W95 FAT32
The Windows installation is located in the disk that have NTFS. In this case, it will be /dev/sda.
9. Navigate to the bin directory under ms-sys as below and install the MBR using following command:
$ cd ~/ms-sys/bin $ sudo ./ms-sys --mbrvista /dev/sda
Done! You can now reboot the PC and remove the USB drive. Your Windows Vista should able to load after that.
Other options that can be use with ms-sys:
$ ./ms-sys Usage: ./ms-sys [options] [device] Options: -1, --fat12 Write a FAT12 floppy boot record to device -2, --fat32nt Write a FAT32 partition NT 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 -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 -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 public domain syslinux 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
This tutorial is also applicable to fix MBR for other Windows platform as stated in the command options above.
- Debian: Converting Apache + PHP to FastCGI – The Simple Way
- Ubuntu: Error Installing MySQL Server
- Install MariaDB Galera Cluster in Ubuntu
- How to Fix ‘Too many open files’ Problem
- Linux: Rsync using Web Interface
- Install OpenFiler from USB Drive
- Apache: Create/Mount Same Identical Directory in Different Path
- MySQL: Live Backup using LVM Snapshots
- CentOS: Using XFS File System for MySQL
- Linux: Mount Box.net Account Locally
- Xbox One makes hot debut as console war revs up - New Straits Times 8 December 2013
- Scientists discover undersea freshwater - The Nation 8 December 2013
- The iWallet Is Coming - Forbes 8 December 2013
- In a Scoreboard of Words, a Cultural Guide - New York Times 7 December 2013
- Lamborghini Gallardo successor previewed by rendering - INAUTONEWS 7 December 2013