Tweak btrfs-snap for More Frequent Snapshots

| Comments

I have been using the btrfs-snap script for a few weeks and it is working very well except for one small problem. Btrfs seems to have trouble if you remove snapshots too quickly.

I made a few simple tweaks to btrfs-snap to help alleviate this problem. I added a check to make sure only one instance of the btrfs-snap script can be actively removing snapshots at a time. I also added a delay between snapshot removals.

This version of the script has been running on my laptop for the last few days, keeping a dozen snapshots at five-minute intervals without any problems. With the original script, btrfs-snap processes would start getting gummed up within the first few hours.

Update 2010-11-14:

I’ve been running this script for a little over two weeks now and I ran into my first runaway snapshot situation last night. Snapshot removal was hanging, and by the time I noticed it I had over 500 extra snapshots of each volume for a total of something over 1650 total snapshots on the file system.

After a reboot, snapshots could be removed again. Early on, the removals took over 30 seconds each, and disk I/O slowed to an absolute crawl. I don’t really want to be stuck with this many snapshots again…

I added a check to the btrfs-snap to make it skip snapshot creation if too many snapshots with the same prefix already exist.

Update 2010-11-29:

I seem to be getting gummed up more often lately, probably every few days. The file system isn’t getting clogged up with huge amounts of extra snapshots anymore, but by the time I notice things went wrong, my process table usually has a few thousand btrfs-snap processes sitting around.

They’re getting hung up trying to count snapshots. It seems that it isn’t possible to get an ls of the .snapshot directory while btrfs is in the middle of failing to remove a snapshot. I moved the check for the sentinel file up a bit so that it creates the lock before counting snapshots. I also added a little countdown loop so that it will give up if it can’t get the lock after a few tries.

Cocktail Arcade Cabinet Build: Part 6 - Fitting the Joysticks

| Comments

We were thinking that routing the holes for the joysticks was going to be one of the hardest steps. It actually ended up being easier and faster than we ever expected.

We are using HAPP Competition Arcade Joystick. It looks like there are two common ways to mount these joysticks.

You can use a metal plate as your control panel and bolt them straight to it. We didn’t like this because we don’t want to see the bolts.

You can also use a thin wood control panel and screw it in from underneath. The joystick comes with a longer plastic spacer to help make up for the thickness of the wood. We wanted the joystick to be as tall as possible, and we didn’t think this seemed very sturdy.

How Did We Do it?

We routed a 2 9/16” square hole through our 5/8” thick particleboard control panels. Then we set the depth on the router so we could countersink the top lip on the joystick so it would be flush with top the of the particleboard. We got a nice snug fit on all four joysticks. Once they are pushed in, they are pretty tough to get back out. I am very happy with the results, since they might not even have to be screwed in.

Drilling the Hole in the Plexiglas

The hole for the joystick doesn’t have to be very big. The first hole we drilled, we used a 7/8” spade bit. We didn’t quite find center, and the joystick was rubbing in one direction. It was easy enough to clean that up, but we learned that it was better to just us a 1” bit instead. As long as the hole is completely covered by the joystick’s little plastic disk, it will be just fine.

What’s the Next Step?

Things are winding down fast now. Most of what we have left is just painting and decorating before we get to the wiring. The next step will likely be painting and applying the textured vinyl.

Countersunk hole for the joysticks Joystick sitting flush in the countersunk hole Joystick under unpainted plexigas Joystick with cover disc under plexiglas All the holes are cut and drilled Close up of a control panel with all its holes Test cut showing an accidental, questionable design

Tire Punctured by 5/8 Inch Wrench

| Comments

It seems to have gone straight in How can this happen? It sounded like a machine gun as the wheel spun around

We were getting ready to start working on the arcade cabinet last when we realized that we didn’t have any of our bar clamps. John remembered that he lent them to our friend Joe the other day, so we took a walk over to Joe’s house.

When we got there he asked us if we had a few minutes because he wanted to show us what happened to him earlier. When we walked over to the car we noticed the small donut spare on the passenger side rear corner of the car. First he showed us some of the damage. The bumper cover had a split in it near the wheel well and every bit of plastic covering around the inside of the wheel well was torn up.

At first I was trying to figure out what sort of oddly shaped high curb he must have hit to manage to make that happen… Then he pulled the tire out of the trunk using the 5/8” wrench protruding from the tire as a handle!

We’re all very curious how it actually happened. We know he was driving at about 35 miles per hour on a straight stretch of road. I’m thinking the front tire may have driven over it and bounced it off the ground and that put it at the right angle that it could somehow puncture the tire. John thinks it may have somehow gotten kicked up over the tire and gotten wedged between the tire and the frame of the car then got forced in as the wheel turned.

Wrenches through tires seem to be a pretty rare occurrence. I only found one similar picture in a few quick Google image searches.

Cocktail Arcade Cabinet Build: Part 5 - Slots for the T-Molding

| Comments

Cutting the slots for the t-molding went quite well. We just had to make a few test cuts with our slot cutting bit in a scrap piece of board to get the slot centered and then we were able to cut the slots on all the legs and arches very quickly.

The slotting for the control panels was a little more complicated and I have been worry about it a bit for the last few weeks. The problem we have is that the t-molding covers 5/8” and we need the molding to cover the 5/8” particleboard in addition to the 0.080” thick piece of plexiglas.

First we moved the slot for the control panels up 0.080”. The t-molding covers the plexigas perfectly at this height. Unfortunately, that leaves us with a 0.080” thick piece of visible particleboard below the t-molding…

We lowered our slot cutter to the very bottom of the wood and shaved off 0.080 inches creating a very thin notch. This is the cut that I have been worried about for a while. Surprisingly, we got a nice clean cut and the remaining particleboard on both sides of the slot seems more than sturdy enough to do its job.

Stack of slotted boards Test t-molding is flush with the plexiglas Test t-molding next to small test piece of blackened plexiglas Diagram of the plexiglas, t-molding, and the two slot cuts we had to make

Cocktail Arcade Cabinet Build: Part 4 - I Love/Hate Plexiglas

| Comments

We finished up our fourth, and longest, day of arcade cabinet construction. We also made significantly less progress than on any of our previous days. Plexiglas is a bit harder to work with than we expected…

We started with a single 36”x30” sheet of 0.080” plexiglas that had just a bit more material than we were going to need. It is the thinnest we could find at Lowes. If we could have found thinner it would have been easier to work with, even cheaper, and would have been just fine for our purposes.

Unfortunately, we cracked the first piece we tried to cut…

Cutting Out The Large Rectangles

I don’t think we’re going to crack any more pieces when we’re making the long straight cuts. We’re clamping the sheet of plexiglas between our workbench and a straight edge. Then we’re repeatedly scoring the plexiglas along the straight edge with a blade. It seems that the deeper we cut with the blade, the less likely we are to cause cracking. This seems very obvious in retrospect.

Rounding the Corners

We were able to rough-cut the curves on the corners by scoring the curve very deeply with a blade. We lined up the plexiglas to the control panel board and clamped them together. Then we just flipped it over so the plexiglas was on the bottom, and followed the curve with the blade.

Once the excess fell off we went around the edge with a belt sander. That made the edge nice and smooth and forced the plexiglas and particleboard into a matching curve. We learned that you have to keep moving the sander. If you stay in one place for too long, the plastic starts to melt.

We probably won’t sand like that again until all four pieces are cut and fixed into place. Then we’ll just go around the whole table and make everything smooth and flush.

Drilling the Holes for the Buttons

This part was pretty scary. Every time we drilled a hole we were worried we’d make a small hairline crack and ruin the whole control panel. We did some testing on our broken piece, so we did learn a bit before we drilled the real panel.

I made up a button template out of a thin piece of cardboard. It has a small hole at the center of each button. We used that to mark the button centers with a marker and we drilled small pilot holes at each point. Without the pilot holes it was difficult for us to keep the larger spade bit centered.

We used a 1 1/8” spade bit to drill the holes. I don’t know if this is the preferred method of putting holes in plexiglas, but it worked quite well as long as we were careful.

We kept the plexiglas clamped to the particleboard control panel but we did not drill all the way through the particleboard with the plexiglas still attached. It is important to clamp the pieces together pretty close to each hole that is drilled. Our test piece was clamped at both ends and it did a pretty good job of vibrating and flexing.

We also learned not to try to drill all the way through the plexiglas and particleboard at the same time. It was easier and safet for the plexiglas to finish the holes after the plexiglas was removed.

The trick seems to be going slow and straight. We only just barely drilled through the plexiglas. We didn’t even drill all the way through. Some of the little disks had to be popped out, and a few stuck to the drill bit.

A Small Change to the Design

We originally planned to have the plexiglas slot around the vertical pieces of particleboard that make up the legs. I don’t think we can cut quite that precisely…

We’re going to widen the slots the control panels fit into by 0.080 inches so we can fit the plexiglas underneath. It is much easier to cut particleboard and it should also do a good job of holding down the plexiglas.

Why Are We Still Using Plexiglas?

We test-painted a small piece of scrap and it looks VERY nice. The plan is to paint the underside of the plexiglas black. When you do this, the top side of the control panels will be very shiny and fairly mirror like. I think it is going to look good enough to be worth the effort.

Making sure the holes will line up Test fitting the buttons

What Comes Next

I’m a bit sad to say that we aren’t ready for the next step. We’re still in the middle of cutting the plexiglas for the control panels. There’s still three more panels to be cut and we still need to cut holes to mount the joysticks.

Update 2010-10-20:

We were able to cut and drill the plexiglas for the other three control panels in less than two hours. Applying a little more patience and using the correct tool helped a lot.

Linux Kernel 2.6.36 on the HP Pavilion DV8T

| Comments

I’ve been running Ubuntu 10.04 on my Pavilion DV8T since it landed on my desk earlier this year. All the important things work, but there were two minor bits of missing functionality and one annoying bug:

  • No working temperature sensors (the hard drive doesn’t count!)
  • ACPI won’t report battery charge/discharge rate
  • ALSA randomly stops making noise after a while

I’ve been running a 2.6.35 kernel ever since I started using btrfs as my root file system but it didn’t help with any of these three problems.

Some Improvements Since Upgrading to 2.6.36

I built myself a 2.6.36-rc5-git6 kernel a few days ago. I can now get a temperature readout from ACPI, but I think it is very inaccurate. I am seeing 134°F when the fan is off, and I’ve seen it read as high as 185°F under moderate load. The laptop never feels hot enough for me to believe either number.

I hope I’m not speaking too soon here, but my sound has been working perfectly for at least four days so far. I’m hoping that I will never have to run my ALSA unload/reload script again.

ACPI still doesn’t report the charge/discharge rate. This makes powertop a little less useful.

I’ve also noticed that powertop is showing that my wake-ups per second during idle are a bit lower. My usual “idle” workload when I’m on battery includes Chromium (with a few tabs open), claws-mail, emacs, and Pidgin sitting around doing nothing while I’m connected to Wi-Fi. With 2.6.35 it was rare to see anything less than 70 wake-ups per second. The last few days I’ve been seeing lots of mid 50s to low 60s with 2.6.36.

I haven’t been on battery enough to determine if there is any improvement in off-power runtime. So far, it looks like I’ll be getting the same 2.5 hours on battery as I always do.

Cocktail Arcade Cabinet Build: Part 3 - Rounding Off the Edges

| Comments

I feel like we made huge progress in the couple hours we spent with the jigsaw on our second day working on the cabinet. It is really starting to take the shape of the finished product now!

Shaped, space-invader-like panels ready to be assembled The Player One side panel Test fitting the control panels Dry fitting the four sides Dry fitting the control panels Dry fitting the control panels More control panels John sitting in the soon-to-be Player One seat

Things are Starting to Take Shape

I may be biased but I think it is starting to look quite awesome. It actually looks quite a bit smaller than I expected. We have a full size top-down mock up drawn on the whiteboard and it looks ginormous up there.

All the material we removed with a jigsaw dropped the weight of the cabinet significantly. I wouldn’t be surprised if we removed more than one third of the material. The particleboard is pretty flexible and we’re getting a bit of wiggle up top where the controller boards slot in. We’re pretty sure it will all tighten up quite a bit once we drop the “floor” in and use some fasteners to tie the control panel boards together.

More Leg Room!

We cut nice big arches in the two long sides so that players three and four can stretch their legs. We were originally going to do the same for players one and two but the space between the sides of the cabinet just didn’t seem wide enough to fit two legs between.

We decided it would be better to just cut a smaller four-inch-high space so you can at least put one of your feet in a little closer. We think players one and two will likely end up sitting with one foot under the table and the other foot off to the side.

What’s Next?

The next step will be to drill holes for the buttons and cut holes for the joysticks. Our plan so far is to cover the control panels and the “cup holder” surfaces with a thin sheet of plexiglas (or some similar clear plastic). I figure we can paint and decorate the underside of the clear plastic and it should look like a nice clean, shiny, mostly black surface from the top.

If we do it right the blackened plexiglas should cover up all the seams where each of the four control panel boards meet up with each other.

How to Stow a Laptop Out of Sight for Less than $4

| Comments

When I upgraded to a new laptop, I also upgraded back to a dual head setup with a pair of external monitors. I don’t need the laptop to be sitting in the middle of my desk anymore, so I wanted to find somewhere I could park the laptop, preferably out of sight.

I picked up four larger PVC J hooks from Lowes for less than a dollar each. I’m pretty sure I used the hooks meant for 1.5-inch PVC pipe.

I screwed two of them to the desk with the J side facing down. This makes the floor the laptop sits on. I screwed one more into the desk with the J side facing up. This one keeps the laptop from tipping out of its little cradle.

I cut the third one down to about one third of its original length. I screwed that one into the desk perpendicular to his other three friends, being careful to position it so that it didn’t block any of the ports on that side. His job is to make sure I don’t just slide the laptop straight through, out the back, and onto the floor.

After it was already in place, I realized that it is probably a good idea to have the front hook mounted a tiny bit higher than the rear hook. That way, gravity would hold the laptop up against the smaller hook.

I have a can of black vinyl dye here. My plan is to spray the hooks and my DIY monitor stand black. I’ve been putting it off because I’ll have to take down the monitors and the laptop for a day or two. One problem is that I don’t want to be without my monitor and laptop stands for a few days. The other problem is that I can’t see any of the PVC from where I’m sitting. I barely realize it isn’t painted.

Laptop hiding in the completed rack Unpainted J hooks attached to the desk Laptop hanging from the unpainted J hooks

Update 2010-11-06:

I finally got around to spraying the laptop rack with vinyl dye and I added a picture of the finished product. It looks much better now and it doesn’t stand out nearly as much as it did when it was bright white.

Cocktail Arcade Cabinet Build: Part 2 - Cutting the Boards and Building the Box

| Comments

After quite a few months we are finally past the planning stage and starting to build something. I am very happy with the progress we are making so far.

We bought two 4’ x 8’ sheets of 5/8” particleboard and had Lowes cut them in half for us to make it easier to transport them home with us. Our quick whiteboard sketches told us we wouldn’t be gaining any useful pieces of board by keeping them whole. We will definitely have no problem at all making the entire cabinet out of these two 4’ x 8’ sheets of particleboard.

Quick sketch of necessary particle board cuts drawn on the whiteboard Slots cut in the rectangular boards Test fitting the rectangular boards Test fitting the (still rectangular) control panel boards

Cutting the Slots

Cutting the slots in the boards with the table saw was easier than either of us expected. The first set of slots we cut were extremely snug and it was VERY solid when we assembled it most of the way. We were worried that it would be too hard to disassemble later on if we ever have to move the table, so we cut the slots a bit wider. We took off about half of a saw blade’s worth of material off the outside of each slot.

It slides together much more freely now but it still does a very good job of keeping itself square.

We cut shorter slots in the sides to mount the control panel boards. We probably made two minor mistakes here. We should have cut these slots to be very snug and we didn’t really leave enough room for the slots on the skinnier sides to get much bite. We’ll just end up having to use some screws to keep the control panels in place.

I’m very happy with the progress so far. We have about four hours invested so far. I certainly didn’t expect to get the rough control panel boards cut and fitted so quickly.

The Next Steps

The next time we get a chance to work on it, we will probably be mostly making cuts with a jigsaw, and sanding.

We are going to cut the corners on the control panels round. We also want to cut some curves into the outsides of the “legs.” We think it will look better if it isn’t just a square pound-sign-shaped box.

We are also going to cut out some of the bottom of the box to make a bit of extra room for feet and legs. We aren’t three-and-a half-foot-tall eight-year-old kids eating pizza and playing games in an arcade anymore. Now we’re six-foot-tall adults eating pizza and playing games at home, and we need to be comfortable!

Hopefully we will be able to make time to work on it for another few hours within the next week or two.

Simple Automated btrfs Snapshots with btrfs-snap

| Comments

I was running btrfs for almost a month before I got around to setting up some automated snapshotting. I was expecting to have to write some scripts of my own, but I luckily I found btrfs-snap. All you have to do is pass btrfs-snap the path of the volume to snapshot, a tag for the snapshot (daily, weekly, etc), and the number of snaphots to keep. It stores the snapshots in a .snapshot directory at the root of the volume and names the snapshots using the tag and a time stamp.

I have mine set up to keep 4 weekly snapshots, 7 daily snapshots, and 24 hourly snapshots. I also tried keeping a dozen five-minute snapshots (fivers). Things got gummed up when I tried that and I had dozens of snapshots processes sitting around idling. I could probably get around that issue by making sure only one snapshot job is running at any given time.

Here’s my cron scripts:

/etc/cron.hourly/btrfs-snap
1
2
3
4
5
#! /bin/bash

/usr/local/bin/btrfs-snap / hourly 24
/usr/local/bin/btrfs-snap /home hourly 24
/usr/local/bin/btrfs-snap /home/wonko/wip hourly 24

/etc/cron.daily/btrfs-snap
1
2
3
4
5
#! /bin/bash

/usr/local/bin/btrfs-snap / daily 7
/usr/local/bin/btrfs-snap /home daily 7
/usr/local/bin/btrfs-snap /home/wonko/wip daily 7
/etc/cron.weekly/btrfs-snap
1
2
3
4
5
#! /bin/bash

/usr/local/bin/btrfs-snap / weekly 4
/usr/local/bin/btrfs-snap /home weekly 4
/usr/local/bin/btrfs-snap /home/wonko/wip weekly 4

And here is a set of snapshots:

Some snapshots
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
wonko@zaphod:~$ ls /home/.snapshot
daily_2010-09-04_07:43:13   hourly_2010-09-12_00:17:01
daily_2010-09-05_07:28:22   hourly_2010-09-12_01:17:02
daily_2010-09-06_08:05:00   hourly_2010-09-12_02:17:01
daily_2010-09-09_06:44:39   hourly_2010-09-12_03:17:02
daily_2010-09-10_08:00:54   hourly_2010-09-12_04:17:01
daily_2010-09-11_07:59:08   hourly_2010-09-12_05:17:03
daily_2010-09-12_07:51:40   hourly_2010-09-12_06:17:01
hourly_2010-09-11_13:17:01  hourly_2010-09-12_07:17:01
hourly_2010-09-11_14:17:02  hourly_2010-09-12_08:17:02
hourly_2010-09-11_15:17:02  hourly_2010-09-12_09:17:02
hourly_2010-09-11_17:17:02  hourly_2010-09-12_10:17:01
hourly_2010-09-11_18:17:01  hourly_2010-09-12_11:17:01
hourly_2010-09-11_19:17:01  hourly_2010-09-12_12:17:02
hourly_2010-09-11_20:17:01  hourly_2010-09-12_13:17:01
hourly_2010-09-11_21:17:02  weekly_2010-09-02_07:51:13
hourly_2010-09-11_22:17:01  weekly_2010-09-09_16:00:25
hourly_2010-09-11_23:17:02  weekly_2010-09-12_07:52:39

Everything has been running fine for about a month. I haven’t filled up my disk with junk snapshots yet. One of the nice things about these writeable snapshots is that I can always prune big files that I don’t need right out of them.