Oct 4, 09:15 PM
Filed under

We take a break from your regularly scheduled Industrial Robot news to bring you this tidbit of helpful information, (which is still related to the robots, but only slightly.) The tidbit is this: GPT is awesome. I shall elaborate:

After telling a friend that I was trying to install Gentoo Linux so I could use it to develop an embedded Gentoo system for one of the Industrial Robot controllers, he alerted me to the fact that “Slackware > Gentoo” (He obviously uses Slackware.) He was making a point that wasn’t really relevant, but I decided to go and see if Slackware had an embedded version. Slackware does indeed have an embedded version and it has pre-built images you can just write to a flash card and go, unlike embedded Gentoo, where you have to get the whole development environment going before you can make any images. Anyway, I went and downloaded the images, and as I go to write them to the flash card, I forget to change which device I’m writing the files to, and write them to the internal hard drive. This was a bad thing to do. A Very Bad thing. This overwrote my partition table, which means that any program looking to see what file systems are on my hard disk, sees only one 32 megabyte file system containing embedded Slackware.

Praise Apple for being a leader and adopting the GUID Partition Table (GPT) standard before most everybody else. The GPT scheme saved me, because it keeps a second copy of the partition table at the end of the disk. I was therefore able to run “gpt recover /dev/rdisk0” on my Mac OS X install disk. This copied the backup table to where it should be at the beginning of the disk. Running this didn’t quit fix the problem however, because the Master Boot Record (MBR) (The old, widely-used, type of partition table) was still blank. I needed the MBR to reflect what was in the GPT because my Linux setup doesn’t use the GPT scheme. This was easy enough. I ran “gpt -r show” on the Mac OS X install disk, which prints out the GPT. I then just used the values for beginning and length of partitions from “gpt -r show” with fdisk to build a new MBR.
I rebooted and everything came back.

It wasn’t quite as easy as that, as I had to figure out about everything and its brother, but that’s all it came down to. I’ve written this so hopefully someone in the same situation will find it and have these three commands they need to fix it. Now all you people who don’t use GPT and are comfortable using dd (The program I used to do the destruction), go back-up your Master Boot Record. It can be done with a simple: “dd if=/dev/yourdisk of=mbrbackup.bin bs=512 count=1” (Linux Only.)

  1. Thank you so much! You just saved my sanity! The recover command isn’t even listed on OS X’s gpt man page.


    — Damon    345 days ago    #
  Textile Help
-->
rss | powered by textpattern | parts may be copyright their respective owners | all else is not copyright sneaktime dot net