Tuesday, January 23, 2018

Lazada price tracker? Try stupidity tracker

I have been using hackintosh (dual-boot with Windows 10) for more than two years without any problems, and recently upgraded to High Sierra. The upgrade process was smooth, and my filesystem is now APFS.

Last Saturday, I switched the power off a bit too early, before the system completely shut down. I knew it was wrong but it's done and I got sidetracked with stuff. The next day, I couldn't log in—it gave me beach ball right after I entered my login.

Tried fsck, safe mode, recovery mode, no luck.

Feels like banging my head.

Good thing I have a MacBook Pro. I took out the SSD from the PC, and put it inside my laptop as secondary disk. Darn, Disk Utility couldn't help.

I had to start fresh. To my disappointment, many files, especially recently (1-2 weeks) accessed files, were corrupted. Unfortunately, those were the source code for Sarah Shopper, the Lazada price tracker I've been working on.

I did use Git, but I have a habit of not pushing to server until the commit is tidy. Since I tend to work on multiple projects at the same time, I can leave them "unpushed" for a while. For Sarah Shopper, it's two months. Ouch.

I also ran a backup software, but it was not configured properly (I procrastinated). Ouch. Good thing Dropbox was working, but I didn't put my code inside it (since I use Git). Ouch again.

Anyway, I managed to "restore" my hackintosh. Here's what I did:
  1. Salvaged anything I could. Apparently, if you copy a folder with any corrupted file inside, the whole copy process stops, leaving the destination in limbo. Strangely, if I select all the files in the folder and copy them, it works and it will ignore corrupted files. So, I did that, recursively.
  2. After everything was copied, I reformatted the SSD and put it back inside my PC.
  3. Reinstalled the hackintosh. I usually use tonymacx86, but I couldn't find the exact page inside the 1st page of search result, so I tried a different method. After a few failures, I gave up and used tonymacx86's method. Worked flawlessly.
  4. After the OS was installed, I had to download, install and configure apps. Office, dev tools, etc.
  5. Setup backup. This time I include my code.

About backup

I use Arq backup software. Now, I backup my home folder with these subfolders excluded:
  • Dropbox, OneDrive, etc, because they can just resync
  • Downloads, because this is just for "transit" items
  • Some folders inside Library
  • Cache folders, e.g. .m2/repository folder for Maven cache
Essentially, I excluded synced folders, caches and temporary items. If you use Arq, the best way to decide whether something should be excluded is to first backup everything, and then check the log. The log lists all files backed up and the size.

About source code

Now I use myrepos, a small command line utility so I don't need to "cd" and "git status" to dozens of my projects one by one.


It took me three days to do everything. Configuration-wise, it's done, but now I need to rewrite the missing code for Sarah Shopper, the Lazada price tracker.



No comments:

Post a Comment

Looking for my geek side?