More Time Machine Surprises

November 14th, 2017


Another HDD bites the dust… I thought I was prepared. It turns out that there are always unexpected roadblocks when dealing with digital data.

Most recently, I decided to use a RAID 1 scheme (mirroring) as an additional piece of my data security plan. I then have a remote time machine backup. The Time Machine disk is smaller than my RAID, and as such, I only backup  irreplaceable data, like photos and documents to Time Machine. The remainder, like MP3s and DVDs I left to the RAID for protection. In the worst case scenario, I can always re-rip a CD or DVD.

Lesson 1: RAIDs aren’t backups!

Things have been going fine, and I’d been living happily with this setup for about 3 years before disaster strikes. My disk disappeared while I was working, which causes all sorts of weird behaviors. One of the RAID slices failed. The failure was so bad that I couldn’t even read any smart data from the disk. I also couldn’t remount the RAID for some reason. I shut down, removed the failed HDD, and rebooted. The RAID disk reappeared!

But there’s a catch… I did a quick check to see if the data on the disk looks accurate. It turns out that it is not. In fact, it is 6 months out of date! How did that happen?? The only explanation is that RAID failed silently 6 months ago. I’ve been operating on only one disk this whole time!

Lesson 2: Mac OS doesn’t inform of RAID failure!

In fact, disk utility (in El Capitan) doesn’t even show problems with RAID sets at all. The only way to verify a RAID set’s health is to check manually using a command in the terminal, or use the Yosemite Disk Utility.

$ diskutil AppleRAID list

I promptly ordered a new HDD. My plan for recovery is to rsync the data from the out-of-date disk to the new disk, and then rsync the more recent backup from Time Machine on top of it. That will ensure that I have the most coverage of my data.

$ rsync -aPE /Volumes/Old\ Volume/ /Volumes/New\ Volume

When rsyncing, I use the options ‘a’, ‘P’, and ‘E’. The ‘a’ is for ‘archive’ and enables a lot of good switches. ‘P’ is so progress is displayed. This is helpful for gauging how the copy is going. ‘E’ is for extended attributes. I use this because I still have OS 9 files hanging around with resource forks that I am trying to preserve.

The plan goes accordingly, and all my data is merged onto the new HDD! I reboot, login, and then discover the new hiccup; I can’t write anything to my user folder. I can’t load preferences, save anything. I can’t even touch a file!

$ touch ~/test.txt
touch: ~/test.txt: Permission denied

I look at the permissions of my folder to make sure everything looks fine, and indeed it does!

$ ls -ld ~
drwxr-xr-x@ 99 michael staff 3366 13 Sep 14:47 /Users/michael/

I can’t wrap my head around what possible be wrong! If the permissions are right, and the user settings are right? What could the problem be?? My brother is smart enough to have me try listing with the ‘e’ option which shows extended attributes.

$ ls -lde ~
drwxr-xr-x@ 99 michael staff 3366 13 Sep 14:47 /Users/michael/
0: group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown

Lesson 3: Time Machine puts protective ACLs on everything!

Access Control Lists (ACLs)… I hate ACLs… A wonderful combination of events led to every file being completely protected from all users via ACLs. First of all, I didn’t know this, but Time Machine protects all the backed up files using ACLs. This keeps users from unwittingly deleting things from their backups. It makes sense, but isn’t something I would have expected to be done on a file level. The second ingredient in this predicament is that I used the ‘-E’ option in rsync which copies the extended attributes. If I had left that off, this wouldn’t have been an issue…

Fortunately, there is an easy solution. Remove all the ACLs from everything! This is done with chmod.

$ sudo chmod -RN ~

This takes a while, but works as expected. My user folder is now working as expected, I can write and save documents. I can read my Photos library, etc. But there’s one more issue… I notice that my homebrew is acting funny. I look at my homebrew directory, and discover that none of the symbolic links have had the ACLs removed.

$ ls -le libpng-config 
lrwxr-xr-x+ 1 michael  501  41 Aug 16 22:50 libpng-config@ -> ./Cellar/libpng/1.6.31/bin/libpng-config
 0: group:everyone deny write,delete,append,writeattr,writeextattr,chown

Lesson 4: ACLs can’t be removed from Symbolic Links!

It turns out that using chmod to remove the ACLs from symlinks doesn’t work. The man page suggests that the -h should be used to remove the ACLs.

-h If the file is a symbolic link, change the mode of the link itself rather than the file that the link points to.

But that doesn’t work either.

$ sudo chmod -hN libpng-config 
$ ls -le libpng-config 
lrwxr-xr-x+ 1 michael 501 41 Aug 16 22:50 libpng-config@ -> ../Cellar/libpng/1.6.31/bin/libpng-config
 0: group:everyone deny write,delete,append,writeattr,writeextattr,chown

Searching online yields similar stories. It sounds like this is a long standing bug. Time to pull out the big guns… A one line bash script to erase and recreate all symlinks!

$ find . -type l | while read link; do echo $link; dest=$(readlink "$link"); sudo rm "$link"; ln -s "$dest" "$link"; done

It works like a charm. I run that across all the data that came from Time Machine, and it looks like I am back in business. Full recovery!

I need to change my way of protecting my data. 2 things I am going to do differently going forward:

  1. I won’t rely on RAID 1. The lack of notification if there is a slice failure is unacceptable. I will now use a weekly rsync chron job to sync my data to a second drive in my computer. Having a fully duplicated drive is handy because you can switch to it immediately in the event of a failure, and not have to go through a lengthy restoration process.
  2. Full backup to Time Machine. Although I didn’t suffer (major) data loss, I think it’s worth buying a larger HDD to create a full Time Machine backup, and not just the irreplaceable documents.

So, there you have it. Hopefully this will answer questions for other people out there, especially about ACLs!

Lego CAD

October 7th, 2017

My first introduction to Lego CAD was an old program I used as a child on Mac OS 7 called Gryphon Bricks. While interesting, it didn’t captivate me very much. I was old enough that I was more interested in the Technic type of Lego set, and there were limitations to the program that I found off-putting.

Since then, I haven’t delved into the world of Lego CAD until this month. I bumped into Bricksmith while searching for something, and decided to download it. Brick Smith is an unofficial Lego CAD program. I read about it  years ago, but never gave it a chance. I downloaded the newest version and was blown away. It uses an extensive library of Lego pieces (from ldraw.org) which include pretty much every Lego piece I’ve ever seen as well as the various prints for these pieces dating all the way back to the 70’s.

As an exercise, I built a T-16 Skyhopper. It went together pretty easily. Bricksmith has some convenient features, as well as some limitations. Everything is grid aligned, and you can move and orient pieces along these divisions. There doesn’t appear to be any concept of mating and piece intersection (which could be seen as a good thing or a bad thing). There is certainly lots of freedom. Once you pick a part, you place it, and you can move it using the arrow keys and rotate it, and select a color. You can copy and paste pieces too.

I’m not enamored with the coloring process. In this case, the problem is that there are so many colors to choose from, that finding them can be tedious.

What I found really neat was the concept of grouping. The pieces can be grouped into steps. Once you complete your model, you can then print the steps out. Step reordering and modification seemed pretty straightforward too.

As a whole, this program is pretty amazing.

While playing with Bricksmith, I spent some time googling to find out more about it, and ran into Lego Digital Designer (LDD), the official Lego CAD system. I somehow had never heard of it even though it was introduced in 2004, so I decided to give it a whirl as well. I played around doing some free builds, and then built a MicroFighter X-Wing.

The experience was very different from Brick Smith. At first, I was annoyed that all the color variation of pieces are displayed as separate pieces int he parts bin, but it actually made getting the correct pieces faster and easier. The other thing I love is that pieces automatically mate to each other. By dragging the piece around with the mouse, the piece automatically snaps to surfaces that are appropriate for mating. This can be faster. Unfortunately, I haven’t found a way of moving a piece directly with the arrows as one can do in Bricksmith. Generally, the auto snapping works well, and if you can’t get it to snap right where you want, usually rotating the camera can do the trick.

The program also knows when two pieces can hinge. The hinge tool is very impressive! After getting comfortable with that, I decided to do a bigger build to put LDD through it’s paces.

The Millennium Falcon. This is one of the larger Lego sets, at over 5,000 pieces. It is no longer sold, and as such, I never had the opportunity to build it in real life. This seemed like a fun way to dive in and see how the program handled. I had the PDF instructions and LDD on screen side by side.

I began constructing this set investing bits of time here and there. Along the way, I fought with some apparent limitations of the program (or it’s user).

However, I did finally complete the model within about a week’s time.

The automatic mating of pieces is a huge time saver when it works. Unfortunately, when there is an intersection problem, the selected pieces are transparent indicating that they can’t be placed. I wish it would highlight the intersection problems in red as it can be difficult to discern where problem areas are. When there are alignment issues, the program is very strict. There are no integrated physics, so hinged pieces don’t fall into place, but stay wherever they are placed. All of the exterior sheets of the Falcon had to be hand adjusted in place to make it fit together.

In some cases, the strict alignment prevented me from following the instruction precisely. In the example above, the hinge pieces are not allowed to bend beyond 90 degrees. In real life, you can forcibly bend them a bit further allowing this configuration shown in the instructions on the left. On the right, you can see that the holes are just barely misaligned, preventing the axle from being inserted.

In other case, I was probably too hasty in finding the proper alignment for elements, and improvised modifications to the model. In the above image, you will note that the angled wing shapes had to be shortened because they were interfering with the adjoining side. This could probably have been resolved by manipulating all the joint angles.

Overall, the tool seems very powerful, and fun. LDD is easy enough to use, that my seven year old can build things on his own, for example, this small Millennium Falcon. The hinging tool and part placement is intuitive enough that he only needed to observe me using the tools a few times to get it, and then be able to do it on his own.

One thing to note though is that some of the part categorization in LDD seems illogical (or at least, not how I would do it). There is a category that appears to be the catch-all for hard-to-classify pieces, and I find myself sifting through there quite often for specific things. Also, one category with an icon of a small wing is in fact home to flat angled, round, and curved pieces, and not just wing shapes which I find bewildering. They were kind enough to include a search feature that lets you filter by part number, size or description. I have had multiple instances where searching by part number provided by the instruction yields no result, yet I could find the part by visual searching through each category.

It’s also been fun using these programs to be able to build sets that are no longer available. While LDD has an easy-to-use UI, and fancy mating and hinge logic, Bricksmith has a superior part catalogue and flexibility for piece placement.

Chocolate Candy Cups

September 7th, 2017

As a young person, I was quite enamored with Reese’s peanut butter cups. Those were one of my favorite candies to eat during the holidays. It’s now been over 5 years since I have tasted them. This isn’t due to amazing will power and good dieting, it’s due to the fact that those candies are lethal to my son. Yet, I still long for those treats.

I decided to make my own that would be safe for my family. I figured I’d be able to find a candy mold for just such a project, but was unable to find any. I was able to make an approximation of a Reese’s peanut butter cup by using cup cake holders, but I still felt that having the correct type of mold would yield better results.

I devised a plan for how I would do it, and then modeled the geometry in Autocad Inventor. The idea is to model the geometry I want (a positive) and use a CNC machine to carve this geometry. From the positive CNC generated shape, I will create a negative mold using a food-grade silicone rubber. Then, finally, I can make the chocolate treats using the silicone mold.

Modeling

Modeling the shape was pretty easy. I figured out the basic dimensions I wanted and modeled accordingly. The final shape should be about 2 inches in diameter and .5 inches tall. Even though I have no intention of wrapping these in paper, I did some careful math to make sure the ridges were appropriately shaped to allow a circular piece of wrapping to be applied. This was done by making sure the perimeter of the ridged top was equal to the circumference of a circle whose radius is equal to the bottom’s radius plus the length of the side.

The goal is to have a void in the chocolate where anything can be put inside.

CNCing

With the model looking okay, I CNCed the geometry out of some scrap hardwood left over from another project.

After CNCing, I removed the positive geometry, and sanded and filled the wood as best I could.

I then put 4 of the positive carvings in a void made out of particle board. Once glued, the whole thing was coated with black enamel to fill the gaps and hopefully make the silicone not stick.

Casting

I ordered a small supply of silicone casting (Smooth-Sil 945) from Smooth-On. This particular product is food-safe, and is activated using a 50:50 mixture of A and B parts, so it’s really easy to use.

Using some simple geometry, I figured out exactly how much material I would need. I poured the correct amounts into disposable bowls and mixed thoroughly, then poured the material into my mold. 6 hours later, I was able to pull the mold out. It turned out very well!

Chocolate

The next step was to take chocolate, and lightly melt it. I used Guittard chocolate, which is nut-safe. I tried different types, but liked the more milky flavors the best (Milk Chocolate 30% Cacoa). Not being a chocolateer, I have a bit to learn. From what I understand, the key to successfully making chocolate treats is to temper the chocolate by melting it at about 115 degrees, then letting it cool slowly at a temperature of 75 degrees. I could be wrong, but it did seem to work.

I was left with things that look like Reese’s, but have an opening and a void on the bottom!

Soy Butter

The delicious insides is a combination of Wowbutter brand soy butter, butter, brown sugar, and powdered sugar. The butter and soy butter are heated, then sugars are added, and then cooled.

It ends up as a dough that isn’t as sticky as the soy butter began. This allows it to be put into the chocolate shells rather easily.

Finishing it up

Now upside-down, additional chocolate is poured to cover the opening and seal in the delicious center.

Conclusion

The result was very tasty, and completely satisfactory. It’s time intensive. The chocolate takes a LONG time to harden. 4-6 hours at room temperature. This can be sped up by placing the chocolate int he refrigerator or the freezer, but cooling the chocolate too quickly can have negative results.

The Reese’s company (Mars) clearly doesn’t make their cups in this manner. Since the paper liner appears to be the actual mold for the chocolate, I suspect they do it in the opposite fashion. They pour the chocolate into the cup with a removable core that leaves a void when removed. The insides get inserted via extrusion, and then the cup gets topped off with chocolate and packaged once solidified. Empty cups that popup online from time to time seem to confirm this theory.

No matter what, I am happy with the result, and my son can now know of the exquisiteness that is a Reese’s cup.