My Rambling Thoughts

Be a good 2.4 GHz neighbour

802.11a/b/g/n uses the 2.4 GHz radio spectrum. It is spilt up into 11 (US) or 13 (rest of the world) 20 MHz channels. Japan even allows channel 14.

For US, only channels 1, 6, 11 are non-overlapping. For R-O-T-W, there are 4 non-overlapping channels: 1, 5, 9, 13. US actually allows channels 12 and 13, but only if they are low-powered.

Ideally, we should be using 1, 5, 9, 13, but the real world conspires against us:

  • Most devices use channel 6 by default
  • Some (most?) devices cannot use channels 12 and 13

It is better to stick to channels 1, 6, 11 and make it work!

802.11n has a channel-bonding mode, where it tries to form a 40 MHz channel from two adjacent non-overlapping 20 MHz channels. This allows the bandwidth to be doubled from 130 Mbps to 300 Mbps. However, it will not work in an urban environment where there are many APs crowding the spectrum.

A scan of my home using the Android app Wifi Analyzer shows 20 wireless networks on the 2.4 GHz spectrum. 20, goodness! Most are on 1, 6 and 11. A few are not. They will cause interference.

A rule of Wifi is that it is better to be on the same channel so that the APs can understand the signals and share the medium effectively using CSMA/CA (co-channel cooperation). Two APs using adjacant channels (say 5 and 6) will cause destructive interference to both channels.

Having understood that, I set my guest network SSID to Use channels 1,6,11 n be faster.

What about 5 GHz? I'm the only one on the 5 GHz spectrum. Of course, it could be that the signal falls off nicely — 5 GHz has limited range and penetrative power. Full speed ahead!

The Dark Knight at your service

The Asus RT-N66U router is officially a Dual-Band Wireless-N900 Gigabit Router, but it is better known by its moniker, the Dark Knight.

It is the king of 802.11n routers:

  • concurrent 2.4 and 5 GHz usage; to be expected
  • max 450 Mbps per band; hence N900 (450+450)
  • Gigabit ports; 4-port LAN and 1-port WAN
  • 2 USB 2.0 ports; able to act as NAS, media or print server
  • supports 3G USB modem; supports WAN failover
  • can be a VPN server
  • can be a personal Cloud server
  • able to install bittorrent app

More importantly, its performance is top-notch.

A few other icing on the cake:

  • up to 6 guest networks (3 per band)
  • supports WoL (Wake-on-LAN)
  • the firmware is open-source

The downside? It costs S$209, and that is after the price reduction after the 5G routers came out. In contrast, the lower-end dual band Asus RT-N56U (N600) costs S$169 and the even lower-end single band Asus RT-N15U (N300) costs just S$79.

It also consumes quite a bit of power. Its power adapter is rated at 30W (19V @ 1.58A), but reviews say it uses 9+ W at idle and typical load. That is 80-85 percentile for routers. In other words, on the high side.

The Dark Knight is powered by a 600 MHz MIPS CPU with 256 MB RAM and 32 MB flash. This may not sound like much, it is pretty decent for a special-purpose embedded system.

The lower-end RT-N56U, for example, uses a 500 MHz MIPS CPU with 128 MB RAM and just 8 MB flash. The RT-N15U has the same spec as RT-N56U, but has only 64 MB RAM.

The Dark Knight was released in early 2012 and is the state-of-the-art for Wireless-N, then and now. There has been no better Wireless-N router. One reason is that the cutting edge has moved to 5G since mid-2012; no one bothers to innovate for 802.11n anymore.

However, the Dark Knight still has a couple of years of life left, until the Wave 2 AC routers become affordable.

The RT-AC66U

The successor to the Dark Knight is the RT-AC66U. It was released in mid 2012 and is a AC1750 router (1300+450). It looks 99% like the RT-N66U and has the same features, AC functionality aside.

You might think it carries on the Dark Knight's legacy. Unfortunately, benchmarks show that it has only average AC performance.

All things considered, I'll prefer to get the Dark Knight.

AC cranks N to eleven

802.11n had a difficult birth. It was a revolutionary upgrade from 802.11g and had many new technology — and patents covering them. We could have it in 2006, but due to patent fights, it was only made into a standard only in September 2009.

The successor 802.11ac, in contrast, was a evolutionary update, so it was made into a standard relatively fast — in January 2014.

First, why the "ac" suffix?

The reason is simple. The IEEE working group assigns letters in sequence, so 'o', 'p', 'q' and so on are used for minor updates. By the time they work on the new Wifi standard, it is 'ac'.

The simplest way to describe 802.11ac is 802.11n cranked to eleven. It is more of the same, but bigger and faster.

  • 802.11n's best modulation is 64QAM. 802.11ac supports 256QAM.
  • 802.11n supports 40 MHz channel bonding. 802.11ac supports 80, 80+80 and 160 MHz channel bonding.
  • 802.11n supports up to 4 spatial streams. 802.11ac supports up to 8, although max 4 per client.
  • 802.11ac supports Multi-User MIMO (MU-MIMO), meaning it can communicate with multiple clients simultaneously.

802.11ac is also called 5G Wifi. It is a nice fit for two reasons: it is the fifth generation Wifi standard, and it operates exclusively in the 5 GHz band.

However, most (all?) routers support 802.11n in the 2.4 GHz band for backwards compatibility.

AC routers are marketed by their total bandwidth: AC600 (433+150), AC750 (433+300), AC1200 (867+300), AC1600 (1300+300), AC1750 (1300+450) and AC1900 (1300+600).

The second number is the 802.11n bandwidth at the 2.4 GHz band using 40 MHz channel width. As you know by now, it is wholly optimistic.

You might be wondering: 600 Mbps for 802.11n? Isn't it limited to 450 Mbps with just 3 antennas? Well, 600 Mbps is due to the use of the 256QAM encoding. It requires a 802.11n client that understands it. In other words, don't hold your breath.

Is Wireless-N obsolete?

No way!

5G Wifi, being the new shiny kid on the block, is very expensive.

And what we have today is merely the Wave 1 products: 80 MHz channel, 3 streams. Wave 2 will bring 160 MHz channel, 4 streams and MU-MIMO.

Wave 1 routers essentially have three bandwidth assuming 80 MHz channel: 433 Mbps (1 stream), 867 Mbps (2 streams) and 1300 Mbps (3 streams).

There are almost no 802.11ac clients today. It'll take a while for new products to use it instead of 802.11n. It's the same story: high-end products will have it first, then it will cascade down the product line. It could take 2-3 years to reach mid-range products.

And even then, most mobile devices will use just one stream, so the bandwidth will be just 433 Mbps (compared to 150 Mbps using 802.11n).

Understanding N

802.11b and 802.11g are pretty straightforward as far as the maximum bandwidth goes. They are 11 Mbps and 54 Mbps respectively.

It is not so for 802.11n. Wireless-N has several possible maximum bandwidth, depending on the device's configuration.

It is actually not difficult to understand, just that there are several variables.

Band2.4 GHz5 GHz
Streams20 MHz40 MHz20 MHz40 MHz
165 Mbps150 Mbps72 Mbps150 Mbps
2130 Mbps300 Mbps144 Mbps300 Mbps
3195 Mbps450 Mbps216 Mbps450 Mbps

Note: assuming 800ns Guard Interval (GI) at 2.4 GHz (20 MHz) and 400ns short GI elsewhere.

802.11n allows up to four streams (using four antennas), so the maximum theoretical bandwidth per band is 600 Mbps. However, I doubt we will see this, as it has been superceded by 802.11ac.

The lowest-end routers only support single 2.4 GHz band and single-stream (using just one antenna). They theoretically allow 150 Mbps, but most likely they will only operate at 65 Mbps due to congestion. It is extremely unlikely that the 40 MHz channel width can be used in an urban environment.

Then we have the mid-range routers that are single 2.4 GHz band and double-streams (using two antennas). They theoretically allow 300 Mbps, but most likely they will operate at 130 Mbps for the same reason above.

One level up, we get the first dual-band routers (2.4 GHz and 5 GHz). As far as I can tell, they always have at least two streams (using two antennas).

Here is where you need to pay attention:

  • some routers don't allow both bands to be used concurrently; this is important
  • some routers have three antennas, but only support two streams (the so-called 3x2:2 or 2x3:2 config, instead of the 3x3:3 that we want)

The routers are marketed by summing up the total bandwidth, although a single client can only use one band at a time (specialized receivers aside). Thus, we have N600 (300+300), N750 (300+450) and N900 (450+450).

Also, note that most mobile devices only have a single antenna, so they are never going to see 300/450 Mbps.

The last wired-only ADSL modem

After my poor experience with the TP-Link TD-W8950ND, I decided to separate the modem and router in the future. There are three advantages:

  • able to keep the home network up even with line issues
  • the router has fewer compromises
  • the router remains useful even after I switch to cable or fiber

The first thing is to find a standalone ADSL modem. If I cannot find it, there is no point to get a separate router!

By "standalone ADSL modem", I mean the simplest 1-port ADSL modem/router. I don't think I have seen a true ADSL modem. OTOH, I have gotten a few ADSL modem/routers in the past. What I do is to set them in bridge mode. That turns off the built-in router functionality.

I went to SLS for my quest. I knew I had a problem after I tried the first few potential shops.

"ADSL modem? No, we only have ADSL modem w/ wireless router."

Oops.

After a few more shops, I thought I better have a backup plan, which is to buy a ADSL modem w/ wireless router and set it to bridge mode. This is dumb, because if I already have a wireless router, why would I buy a separate router?

Anyway, after combing the entire SLS, I found one shop that still has a 1-port ADSL modem/router. It is the D-Link DSL-526B.

It costs S$45. Jackpot!

The casing and specs are from 526E, but it is labelled as 526B. Color me confused.

For $4 more, I can get the D-Link DSL-2542B, which is a 4-port ADSL modem/router.

So I just need to choose between the two?

Not so fast. I can get a Prolink ADSL modem w/ 150 Mbps Wireless-N 4-port Fast Ethernet router for S$59. (What a mouthful!)

I won't need a separate router if I get that. For S$59, I could end my quest right there.

It was indeed very tempting.

But after some consideration, I decided to buy the 526B:

  • it is my goal to separate the modem and router
  • I'm not sure if I can set the modem w/ wireless router into bridge mode
  • a dedicated modem is better at being a modem
  • it is simpler; fewer things can go wrong
  • it consumes just 6W (12V @ 0.5A)

Note: I later figured out that an ADSL modem w/ router should allow bridge mode even if it is not listed as a feature.

What is bridge mode?

As I mentioned above, bridge mode is simply turning off the router functionality and turning the ADSL modem/router into a dumb modem. A separate device, usually a router, is responsible for dialing out to the ISP.

For some devices, there is no way out of this mode except a NVRAM-reset... (which is fine because we don't store anything inside.)

There is also a half-bridge mode. In this mode, the modem becomes "invisible" and the router acts like a switch. The LAN port has the WAN IP address, so the computer is directly on the Internet.

We need to set the user id / password in the ADSL modem/router so that it can connect to the ISP.

Modem/router took the early retirement package

My integrated ADSL modem/router, the TP-Link TD-W8950ND, just gave up the ghost.

It sort of works, but will reboot every 5 minutes or so under light load. It does this even if the phone line is disconnected, so it is not a line issue.

I think I bought it in 2010? I have been running it 24/7 for 3+ years.

I was planning to replace it, and this forced me to accelerate my plan by a few weeks. Maybe it knew, so it decided to retire early... :-D

The best things I can say about it:

  • It is compact
  • It uses only 12W (12V @ 1A)
  • It is usually reliable

The administration webpage is not the best in the world, but it is functional.

OTOH, the modem is just plain bad. It takes way too long to connect, and if disconnected, it takes its own sweet time to reconnect. And the home network will hang when it has line issues.

No, I won't miss it a bit. :lol:

WD Green drives needs a patch

The things you learn every day.

While browsing through a pricelist, I saw WD has a new HD model: the AV-GP. It is part of the Green Cavier series and is optimized for A/V. The difference? It won't stall on errors. Better to lose one sector of data than to skip several seconds/minutes of playback/recording due to error recovery.

Not something you want in a data drive.

Then I saw posts saying the normal Green drives are not suited for 24/7 server use too. It has a so-called "IntelliPark" feature that parks the drive's heads after just 8 seconds of inactivity!

8s. This is crazy!

I wasted no time checking my drive: 771,793 load cycle count! WD claims it can go up to a million, but most people think 300,000 is a saner upper limit.

This is over a period of 17,612 hours, or exactly two years. That is almost 44 load cycles per hour, or one every 1.4 minutes.

The only way to change it is to use a DOS-based utility to change the idle3 timeout. In this age and time? Seriously?

I have five WD drives:

DriveSizePower CyclesLoad CyclesPower On Hours
Primary2 TB49771,79317,612
New2 TB5291167
My Passport1 TB90762917
My Book Essential2 TB1971,834218
My Book3 TB69288126

My primary HD has been up almost 24/7 for two years. It has bad sectors a few months back, which is why I have prepared its replacement. However, I have not swapped it out since it is still working. :lol:

It is a good thing I seldom turn on the external HDs. The only way to change the timeout is to take them out of their enclosures and hook them up as internal drives. That's a lot of work. For now, it looks like their load cycles are pretty low.

The Wired Home Masterplan

I'm using a 4-port 150 Mbps 802.11n router with integrated ADSL modem to power my home network.

At that time, I went for an integrated solution for power efficiency and to simplify my device setup.

There are a few problems:

  • The modem takes it own sweet time to connect to my ISP. This is a problem when I need to reboot it. There is no guarantee it will connect successfully. I often need to force it to retry a few times.
  • If I need to reboot the modem to resolve a line issue (happens from time to time), it takes the home networking down with it.

I am exploring a few different options for my next generation setup:

  • 4-port 300 Mbps 802.11n router w/ ADSL modem
  • ADSL modem, 4 port (Gigabit) 300 Mbps 802.11n router
  • ADSL modem, 1 port (Gigabit) 300 Mbps 802.11n router, 8-port Gigabit switch

I want to separate the ADSL modem and router, so the first option is out.

The cost of a 300 Mbps 802.11n router has come down significantly. Dual band is still expensive, but I'm considering if it is worth the cost.

The new wireless standard, 802.11ac, was just approved in January 2014. This is not a good time to get it for a few reasons. First, most routers are still using the draft 802.11ac standard. Second, the first version (of the wireless chipset) is usually buggy. Third, we are paying to be the first on the block.

This time, I want Gigabit Ethernet. Fast Ethernet, at 10 MB/s, is too slow for multi-GB transfers.

4 ports should be sufficient, but I'm considering going one step further to wire all the rooms. And if I'm going to do that, I'm considering having two ports per room! Most routers come with only 4 ports, so a separate 8-port switch is the only choice.

There are three nice-to-have features I'm looking for in a router:

  • Dynamic DNS
  • Guest network
  • Wake-on-LAN (WoL)

Dynamic DNS is a pretty standard feature.

Guest network is usually available (for non low-end routers). It would be a bonus if it supports two guest networks.

WoL is a pretty rare feature, though. Also, I might not use it because it means exposing the router's webpage on the Internet — and routers' webpage are not known for their security.

Bike COE, missed the cheap train

transport

The bike COE has been skyrocketing in the past month. From $1,989 in January, it is now $4,001!

$4k is just $300 shy of my bike price. My YBR125 will celebrate its 10th birthday on 21st December this year.

When the COE went to $2,704 for Janurary's 2nd bidding, I made a mental mark to consider renewing the COE in February. Somehow, I missed that. The PQP was $1,952 in February. It is now $2,474.

It is hard to say if the high price is the new norm or a knee-jerk reaction to the sharp decrease in the bike's quota.

Anyway, I bit the bullet and paid up.

I have a theory why LTA wants motorbike COE to spike: it wants to get rid of the old bikes. If COE is low, people will just renew and the old bikes will be around forever.

From Linux to Windows

My old xw8600 Linux workstation, a 2-CPU Xeon X5450 @ 3.0 GHz PC with 4 GB RAM and 440 GiB HD, is decommissioned, so I turned it into a Windows machine.

It replaces the xw8000 ex-Linux workstation, 2-CPU Xeon @ 3.2 GHz PC, that I turned into a Windows machine a few years ago when the xw8600 replaced it. Now, that is really showing its age.

It is pretty easy to install and set up Windows 7. The only issue is the long wait for the patches to download (a couple of hours) and the repeated restart cycles.

I only have a short list of apps to install to get back in business:

  • 7-Zip
  • Firefox
  • Media Player Classic Home Cinema
  • MS Office
  • Notepad++
  • Opera
  • putty
  • TightVNC Viewer
  • WindowsPager

I use my Windows PC mostly as a thin client these days.

32 or 64 bit

These days, OS come in two flavours, 32-bit or 64-bit.

I chose the 64-bit edition to simplify "fleet management". Unlike Linux, 32-bit Windows can only use max 4 GB RAM. We need to use 64-bit Windows to take advantage of more RAM. The simplification is on the apps: I only need to download the 64-bit version for all my Windows machines.

Of course, it does not work perfectly in practice because I still have a couple of old sluggish 32-bit Windows machines. Thankfully, they will be put out of their misery soon.

Workstation disk usage

My workstation has just one single 913 GB partition. I'm thinking of using multiple partitions, following my standard partitioning scheme.

The first thing is to find out the current disk usage.

bin10 MB
boot59 MB
etc42 MB
lib369 MB
lib6432 MB
opt756 MB
root53 MB
sbin15 MB
tmp13 GB
usr8.0 GB
var2.6 GB

tmp, usr and var are a magnitude larger than the other directories.

It looks like 20 GB should be sufficient for / (everything above excluding tmp and var).

And since the workstation has 16 GB RAM, I may just create a 6 GB /tmp partition using tmpfs.

Cheap trick to copy in parallel

It is possible to copy the same files from one HD to two HDs in parallel at full speed, as illustrated below:

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          18.51    0.00   20.85   37.45    0.00   23.20

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.00     0.00  175.00    0.00 22608.00     0.00   258.38     0.57    3.25    3.25    0.00   2.08  36.40
sdb               0.00     0.00    0.00  184.00     0.00 21806.67   237.03   143.14  780.17    0.00  780.17   5.43 100.00
sdc               0.00     0.00    5.33  182.00    21.33 21641.33   231.27   142.51  751.57    3.00  773.51   5.34 100.00

The two external USB 2.0 drives (sdb and sdc) are max'ed out at 21.3 MB/s (util 100%). But notice we are only reading the source (sda) at 22.1 MB/s.

The trick is to start both copying at the same time.

It works for quite a while until the copying gets out of sync and the data is flushed out of the memory cache before it can be copied a second time.

Then we revert to the normal case where we have to read once for each copy:

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          15.08    0.00   14.15   32.97    0.00   37.80

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda              32.33     0.00  216.67    0.00 31590.67     0.00   291.61     1.83    8.45    8.45    0.00   4.60  99.73
sdb               0.00     0.00    0.00  138.00     0.00 16293.33   236.14    64.72  482.08    0.00  482.08   4.68  64.53
sdc               0.00     0.00    0.00  140.67     0.00 16634.67   236.51    70.43  486.04    0.00  486.04   4.82  67.87

Notice we are reading sda at 30.8 MB/s, but are writing to sdb and sdc at half of that? Now is sda's turn to be max'ed out (util 99.7%), probably due to seeking. We are still far from sda's max read rate of 60+ MB/s.

The 5% disk space tax

I vaguely recall that Linux reserves some disk space for root to prevent a normal user from creating a disk-full situation. However, I was not sure if it were still done today.

It is. 5%.

5% of 1 TB is 50 GB. It does not make sense to reserve so much space in this day and time! 5% is a holdover from the days where HDs are 1+ GB. Also, it does not make sense at all on an archive data partition.

To view:

sudo tune2fs -l /dev/sdb1 | grep "Reserved block count"

It is easy to change it:

sudo tune2fs -m 1 /dev/sdb1

This sets it to 1%. This is still quite significant: 1% of 1 TB is 10 GB! For larger drives, we can use 0.5%.

I must have issued this command in the past, because it is 2% for /home and 3% for other partitions. However, I did not seem to write it down. There are some gaps in my writeup.

We can also use the -r option to specify it in number of blocks:

sudo tune2fs -r <blk_count> /dev/sdb1

It is possible to set the reserve space to zero. But that does not mean we should use up the entire disk, especially on the OS / home partitions. (In Windows, this means the drive(s) containing Windows and Users.)

Performance degrades for all HDs — mechanical or SSD — when the disk gets full. For mechanical HDs, it can be felt once the free space dips below 50%. And it becomes obvious when free space is below 25%.

For SSDs, performance can fall off a cliff when free space is below 10%. The reason is that the SSD can run out of empty blocks for fast writes. When it does, it must read the partially-filled block, erase it, then write the data back.

Big fan of Studio Ghibli

Implies big files.

ShowGroupResSize
Castle of CagliostroTHORA720p4.4 GB
Castle of Cagliostroneo10241080p6.4 GB
Kiki Delivery ServiceREVO1080p18 GB
Howl's Moving CastleTHORA720p2.9 GB
LaputaTHORA720p8.0 GB
LaputaTHORA1080p18 GB
NausicaaREVO1080p18 GB
Porco RossoAnimeNOW720p5.7 GB
Porco RossoBDMV39 GB
Princess MononokeBDMV45 GB
TotoroTHORA1080p9.0 GB

The only disappointing video is neo1024's Castle of Cagliostro (CoC). Despite his claim of being better than THORA, his encode has visible artifacts. THORA's, on the other hand, is beautifully cleaned up.

Originally, I only downloaded the 720p videos since they were good enough for me. But later, I decided it makes more sense to freeleech the 1080p videos and downsize them myself.

The 1080p videos are humongous, but they are about 50% of the original Blu-ray and are virtually indistinguishable.

I got BDMV for Porco Rosso and Princess Mononoke when they were just released and no one had made an encode for them yet. If there is another BDMV I want to get, it would be Nausicaa. These three are among my favourite Studio Ghibli shows.

Spirited Away is not on the list because it is not released on Blu-ray yet. However, I'll probably just get the 720p video. The show does not have a coherent plot. Notice I only got the 720p video for Howl's Moving Castle too. Not a big fan of it either.

IMO, Hayao Miyazaki's last good show was Princess Mononoke (1997).

To summarize:

  • worth getting BDMV: Nausicaa, Porco Rosso, Princess Mononoke
  • worth considering BDMV: CoC, Laputa
  • worth getting 1080p: Kiki Delivery Service, Totoro
  • only worth 720p: Howl's Moving Castle, Spirited Away

Pruning old kernels

Unlike RHEL 6.x, Ubuntu does not auto-prune old kernels, so we have to do it ourselves:

sudo apt-get remove $(list_old_kernels.sh)
sudo apt-get autoremove
sudo update-grub

list_old_kernels.sh is a bash script I wrote to list old kernels. It considers a kernel safe to prune if it is:

  • not the current kernel
  • more than 120 days old
  • not the most recent 3 versions
  • not the latest patch (e.g. ver.major.minor-patch)

There are four kernels left after pruning. / now uses only 38%. /boot is now 95 MB and /lib 489 MB.

It looks like 11 GB is sufficient for the root partition after all.

File server disk usage

My present disk usage:

FSSizeUsed %
/11 GB71%
/var2 GB28%
/var/log1 GB10%
/var/tmp1 GB5%
/tmp2 GB4%
swap2 GB
/home1.8 TB68%

All the partitions have sufficient headroom, except for /.

Breakdown of /

bin8.4M
boot654M
etc13M
lib3.2G
opt4.0K
root196K
sbin8.7M
selinux4.0K
srv4.0K
usr3.0G

lib and usr are pretty big.

boot is surprisingly big too — there are 30 boot images inside! I'm surprised it is not auto-pruned.

Backup, verification and USB 2.0

Suppose I have 1 TB of data. How long does it take to backup to an external USB drive formatted using NTFS?

My PC has only USB 2.0 ports. The write transfer rate is just 13 MB/s.

Answer: 22.4 hours!

After backing up, I would like to verify that the data is correct. How long does it take with the read transfer rate at 32 MB/s?

Answer: 9.1 hours.

USB 2.0 just does not cut it anymore.

Note: after I formatted my external USB drive to ext4, the write transfer rate is now 27 MB/s.

(The theoretical raw USB 2.0 bandwidth is 480 Mbps, or 60 MB/s.)

Networking, worse

If you think USB 2.0 is slow, wait till you transfer files over the network:

RatedActual
802.11g54 Mbps1.8 MB/s
802.11n (single channel)150 Mbps3.3 MB/s
802.11n300 Mbps~7 MB/s
Fast Ethernet100 Mbps12.5 MB/s
Gigabit Ethernet1 Gbps125 MB/s

Note: we need to distinguish between bps (bits/sec) and Bps (bytes/sec).

802.11n is slower than Fast Ethernet even though it has a higher theoretical raw bandwidth. It has more overhead and interference that it will never achieve its rated speed.

Wireless is undoubtedly more convenient than wired, though.

Only Gigabit Ethernet has the bandwidth to transfer files at high-enough speed to rival local HDs (except SSDs).

Backup: rsync is your friend

It is hilariously easy to backup on Linux: simply use rsync.

The man-page for rsync says: a fast, versatile, remote (and local) file-copying tool.

So it is a one-stop solution for copying files. There is no need to use cp anymore, except due to inertia.

Here is how I backup my stuff:

rsync -a --progress /home/repo /media/OfflineStore

It is so simple that I don't even bother to put it in a script.

rsync does not verify after copy. If we want to do that, then suddenly it is not so simple anymore.

What we need to do:

  • Tell rsync to output the files it copied
  • diff the files in src and dest

Auto-mount external USB drives

For some reason, Ubuntu 12.04 refuses to auto-mount external USB drives even after I changed the PolicyKit udisk policy.

Manually mounting the drive every time gets old.

The solution? Add it to /etc/fstab.

First, we need to find the drive's UUID. That's easy. Just run:

sudo blkid

We'll see something like:

/dev/sdb1: LABEL="OfflineStore" UUID="0011223344556677" TYPE="ntfs"

We can mount a drive using /dev/sdb1, but it is not advisable to do so because the path can change — especially for external USB drives; it depends which port you plug them in. A UUID is tied to the drive itself and will not change.

Add to /ect/fstab:

UUID=0011223344556677  /media/OfflineStore  ntfs  defaults,nobootwait,nodev,noexec,nosuid,uid=1000,gid=1000,fmask=177,dmask=077  0  2

nobootwait is to prevent Ubuntu from hanging if the drive is absent during system power-up. It is possible to continue by pressing spacebar, though not on my headless server (no keyboard).

uid, gid, fmask and dmask are used to simulate the files' owner, group and permissions. There is no mapping from NTFS file-system permissions to Linux. They are not important when you copy the files into the drive, but they are important when you copy the files out.

Why is my external USB drive formatted as NTFS instead of ext4? Good question.

I thought I could attach the drive to my Windows notebook to transfer files. But it turned out that I never did so. The drive is really used for backup only.

One day, I'm going to reformat the drive as ext4. But I need to find 2 TB of free space first. :lol:

Convert FLAC to MP3

I found it interesting that I never document how I convert my music CDs to MP3.

First, I rip the music CD to FLAC files using ExactAudioCopy.

I then use lame to convert the files to MP3:

for f in *.flac; do
  flac -cd "$f" | lame -V 2 -b 160 - "${f%.*}.mp3"
done

In the past, we need to set a long list of options, but today, we just need to set two: -V = quality, -b = minimum bitrate.

Note: lame uses joint-stereo if -V > 4 or bitrate <= 160 kbps.

I could never remember the exact syntax. I needed to google every time I wanted to do this. I'm writing it down now. :lol:

I use 160 kbps as it is the minimum acceptable quality for me on a variety of speakers.

Portable video resolutions, updated

Since July last year, I have transcoded most of my shows (that I would rewatch) to 360p. It turns out to be good enough for most cases that I only transcode to 480p in rare cases.

Originally, I always use 64 kbps for the audio at 360p, but now I vary it based on the show.

Audio bitrate
Lecture32 kbps
Standard64 kbps
OVA/movie96 kbps
MovieHi128 kbps
Concert160 kbps

I use 96 kbps for most OVAs/movies and 128 kbps for music/effects-intensive shows.

For 480p, the audio bitrate is shifted by one level (standard = 96 kbps).

Simple ang pow rate

We decided to have a very simple almost-flat rate for ang pows this year.

StrangersRM5
Young relativesRM10
Older relativesRM20
Close friends/relativesS$20

This year, the cut-off for "older" is working age. Next year, we'll bring it down to 13 years old.

We also need to distinguish between close friends and relatives. It turns out that close relatives are too generous. :lol: We need to give more to match their rate.

The white master bathroom

The master bathroom is based on the minimalist design. It is predominantly white and there is no storage space at all.

There are three different wall tiles with two strips of mosaic. One for the feature wall, one for shower wall, and one for the rest of the bathroom. There are two floor tiles, one for dry and one for wet area.

The bathroom is now brighter, but we still need to turn the lights on during day time.

Miscalculation: the main door blocks access to the wash basin when it is open. We usually leave it open for convenience. It is still possible for a slim person to squeeze past, though.

The mirror is a little too small (48x60cm, iirc). I'll prefer a much bigger one, but I couldn't find one off-the-shelf.

The bathroom reopens

The common bathroom is based on resort-style design and is intended to be relaxing.

There are two different wall tiles: one for the feature wall and one for the rest of the bathroom. There are two different floor tiles: one for the dry and wet area, and one for the walkway between the two doors.

We should have installed a rain shower here too.

The bathroom is much brighter. There is no need to turn the lights on during day time.

Small issue: the hot/cold water controls are inverted. The controls are also a little higher than normal. This is the downside of sharing the pipes with the master bathroom. (They share the same wall.)

Miscalculation: the wet area floor tiles are a bit too dark. They are alright when dry, but are too dark when wet.

The mirror is hung a little too high — by 2cm. Yes, even a little matters.

Free Wifi, but first come first serve

I stayed in a hotel that offers free Wifi connection. There were two problems. First, it was very slow. But worse than that, after 6pm or so, I could not even get on the network.

The reason? The hotel uses the 192.168.1.0/24 subnet, which means the network can only support 253 hosts (.1 = gateway, .255 = broadcast).

That sounds like quite a lot, except that the DHCP lease is valid for 3 hours. Once taken, an IP address will be reserved for at least 3 hours, even if the device is disconnected 5 minutes later.

The solution is to increase the hosts by using a subnet such as 192.168.0.0/22, which allows 1021 hosts. Also, the DHCP lease should be shortened to 15 minutes so that IP address for inactive devices are reclaimed back quickly.

Have passport, will criticize

Poor chap. He put up a tasteless comment, got flamed left and right, had to issue an apology, and then he got fired from his job and fled to Australia.

Personally, I thought it was no big deal. But it pissed off many people. Do you know why? Because it hit a raw nerve.

And that, is the real problem.

The problems? Rich vs poor, elites vs peasants, car owners vs public transport users.

Poor chap. He was just an outlet for the masses. They missed the real issues.

Firmware update at the wrong time

I usually buy a U-Mobile pre-paid card when I go back to Malaysia. They have four plans: RM18, RM28, RM38 and RM48. Unfortunately, the RM38 plan only offers 500 GB data and you need to pay RM48 to get 2 GB data.

2 GB ought to be sufficient for 8 days stay.

Midway, I checked that I had only consumed 0.7 GB. Still a lot of room.

A few days later, I got a "20% left" notice via SMS. What!

That's when I found that the phone had downloaded a 700+ MB firmware update!

I quickly bought a RM10 top-up: 1 GB that is valid for 3 days. Actually, I didn't need to. It turned out that I rationed my usage.

Moral of the story: turn off firmware update.

GPS woes

I needed to use my father's GPS unit again. This time, I would be travelling on "new routes", so I decided to play it safe and update the map.

The instruction said to unzip the file into a certain directory in the GPS unit's SD card. Since the directory already existed, I deleted it first.

I then clicked the Navigation icon. It did not start.

It then dawned to me what I have done — I have deleted the GPS app! I was supposed to unzip the file into the existing directory to overwrite the old map.

First thought: panic.

Second thought: not a problem. I can just download the full app. So I did that.

A few hours later, I installed the app. It required an activation key. Not a problem. I just need to go to the website to input the hardware id. I had done this one year ago when I upgraded the GPS app. But this time, the website rejected the id.

Now is a good time to panic.

Google Maps Navigation

It turns out that the Google Maps Android app has a pretty acceptable navigation built-in. It is far easier to use than the GPS unit.

Downside? Eats battery for breakfast. I think the battery level drops 1% every 1-2 minutes. An in-car charger is essential. The phone runs pretty hot as well.

Another downside: requires constant data connection. It does not seem to use a lot of bandwidth, though. It should be possible to preload the map — although you want to avoid getting lost and venture out of the preloaded maps.

Helpline

A few days later, I finally found the time to call the helpdesk. Once I said the website rejected the id, the customer service officer said I entered it wrongly.

I countered that I checked it very carefully. But I started to have some doubts, so I went back to check. Sure enough, I missed one character!

It worked after all.