Posts tagged with usb drive

Accidentally Wiped my Windows Partition

March 6th, 2008

After all the testing with creating bootable USB drives and trying many different distributions I guess the inevitable had to happen. At some point in my partitioning/formatting of the USB drive I’ve typed

/sbin/mkfs.vfat -F 32 /dev/sda1

instead of

/sbin/mkfs.vfat -F 32 /dev/sdb1

Only a small error, replacing sdb1 with sda1, but the result is that I reformatted my main Windows XP Professional NTFS partition to FAT32 and in the process lost Windows. I’m not bothered about data loss as I keep anything important in my Linux partition that’s also backed up to a NAS device. What I’m really bothered about is the prospect of reinstalling Windows. In my experience it goes something like this:

  1. Boot using my Acer install disk (pre SP1 from 2003).
  2. Wait 30 minutes for install to complete.
  3. Reboot, listen to annoyingly loud music while setting my computer preferences for the first time.
  4. Reboot again.
  5. Spend 2 hours (minimum) customizing and uninstalling the crap put on my computer.
  6. Go to Windows update and start the painful process of getting a pre SP1 XP Professional computer to SP2. This usually requires 50 to 100 updates along with maybe 3 reboots on the way. Allow at least 3 hours for this with a fast internet connection.

If all goes well the whole process will take an entire evening. Not forgetting that the fresh Windows install will overwrite my mbr so making my dual boot laptop into a single boot Windows only machine requiring me to boot into a live Linux distribution and then installing GRUB on the mbr again. Phew!

Compared to this exercise in time wasting, installing any new Linux distribution these days seems like a walk in the park. I’ll just have to be extra careful in future when formatting drives.

Overwrite MBR from Linux

February 21st, 2008

If, like me, you are experimenting setting up usb drives as bootable Linux devices then you’ll find that after installing grub on the drive just deleting all the files will not remove grub. You need to completely wipe the Master Boot Record (MBR). Assuming your drive is located at /dev/sdb use this command as root:

dd if=/dev/zero of=/dev/sdb bs=512 count=1

Be very careful to do this on the correct drive! One error and you will wipe the MBR on your main hard drive leaving your computer unable to boot.