Sunday, March 13, 2016

Juno's Final Upgrade

Juno, my desktop computer, started out in early 2010 with a 40 gigabyte (GB) solid state drive (SSD) to hold the operating system, and a 500 GB hard drive to hold everything else. (An SSD is much faster than a regular hard drive.) About 2½ years later, I upgraded Juno to a 128 GB SSD (Samsung 830), putting aside the 40 GB drive (an Intel X25-V). Now the SSD could hold my personal files as well, excepting all the photos and videos, which still resided on the hard drive (Hitachi 2.5" 7200 rpm). This further improved Juno's peppiness. In early 2014 I moved Juno into a new case, just for the purpose of taking up less room on my desk.

Juno is equipped with 4 gigabytes of RAM (main memory). This was plenty starting out six years ago, but now, when I have my email program, web browser, thumbnail viewer, and photo editor running, they don't all fit into memory at the same time. A process called "swapping" takes place; the operating system (Linux in this case) picks something residing in memory that hasn't been active for a while and copies that to the hard drive, freeing up RAM for the program that needs more memory.

Swapping slows everything down. Badly. Click to bring a program to the front, and hear the little hard drive chittering away as it writes stuff out to make room for that program, and fetches the previously swapped-out program. Sometimes it can take 10 seconds.

I decided to experiment with reusing the old 40 GB SSD as the swap drive. In the early days this was discouraged, because it could lead to premature wearing out of the SSD. However, because Juno swaps only during peak loads, and because I anticipate needing only a year of service before building a fresh computer, I decided to go ahead. The alternative, buying more RAM, would have been more expensive and much more work -- disconnecting cables from the motherboard, removing the motherboard, and then removing the heatsink from the motherboard to access the RAM slots. Ugh.

Juno has one available SATA connector on the motherboard which could accomodate the SSD, but the interior of the computer is cramped after the transplant to the new case. I decided to use the external SATA port (eSATA) of the computer, and place the SSD in an enclosure to connect it in a tidy fashion. I chose one from Oyen Digital, which comes with any cable I might conceivably need, and ordered from Amazon.

Here is the opened box. In case you need lots of oomph, a wall-wart AC adapter is also included.
Here the old SSD has been inserted into the tray that pulls out of the adapter's housing.
It didn't work at first. After spending some time trying alternatives, including using a spare 2.5" HDD instead of the SSD, I finally figured out two things. First, the eSATA cable isn't carrying power, so I had to additionally plug in the supplied USB to DC-in cable. Second, although there was stuff on the SSD, an icon for it did not appear on the desktop even when the power issue was resolved. Disk drives and thumb drives plugged into the USB ports result in desktop icons, but the eSATA port apparently does not. Once I figured out that the lack of an icon didn't indicate a problem, everything began to work. Here's a view of the back of the enclosure, with the two cables.
This is how it looks from the front. The little box on top is the enclosure; its blue LED light is a power indicator.
When all goes well and the swapping takes place on the SSD instead of the HDD, a heavy-swapping situation induces a silent, 1 or 2 second lag instead of 10 seconds of disk chatter. That's pleasing. However, after a day I ran into problems.

Inspecting the system log (/var/log/syslog), I could see that sometimes the connection was established at full speed (3.0 Gbps). Just as often, however, Juno would back down to 1.5 Gbps. This wasn't fatal, but it was odd.

Then, while shorter sleeps ("suspend to RAM") appeared to work OK, the overnight sleep was a problem. (Interestingly, the LED indicated that the SSD had power even while the computer was asleep.) The connection to the external SSD would suffer several timeouts, and when the computer finally came up, the Internet connection was down. That should be unrelated, but a consistent coincidence isn't a coincidence, is it? 

I found messages that indicated some kind of SSD corruption; for example, the serial number of the SSD came out wrong -- it looked like a fragment of a pathname. I performed a factory reset with the command "hdparm --yes-i-know-what-i-am-doing --dco-restore /dev/sdc" and then the data from "smartctl --info /dev/sdc" looked sane again. However, I still had the problem the next morning.

It was time for step-by-step testing.

Test #1: turn off and remove the external device. Overnight wakeup is OK.

Test #2: install external device, but don't power it up. Overnight wakeup is OK, as you would expect.

Test #3: power up external SSD, but don't use it for swap or anything else.

At power-on:

Mar  6 14:32:43 juno kernel: [38604.492274] ata4: irq_stat 0x00000040, connection status changed
Mar  6 14:32:43 juno kernel: [38604.492278] ata4: SError: { PHYRdyChg CommWake LinkSeq TrStaTrns DevExch }
Mar  6 14:32:43 juno kernel: [38604.492286] ata4: hard resetting link
Mar  6 14:32:44 juno kernel: [38605.328024] ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
Mar  6 14:32:44 juno kernel: [38605.328241] ata4.00: ATA-7: INTEL SSDSA2M040G2GC, 2CV102M3, max UDMA/13
Mar  6 14:32:44 juno kernel: [38605.328245] ata4.00: 78165360 sectors, multi 1: LBA48 NCQ (depth 31/32)
Mar  6 14:32:44 juno kernel: [38605.328478] ata4.00: configured for UDMA/133
Mar  6 14:32:44 juno kernel: [38605.328506] ata4: EH complete

After overnight sleep: everything was OK!

Test #4: activate the SSD as a swap device, and don't turn it off overnight. (I reduced the size of the swap area from the entire 40 GB to 12 GB, just in case it was too much. Twelve is still 50% larger than the swap area on the hard drive.)

Everything is OK! Hmm. Also, there has been no resetting the link down to 1.5 Gbps from 3.0. Perhaps the factory reset on the SSD followed by turning it off and back on fixed something?!

Test #5: turn off the HDD swap device, "swapoff /dev/sdb1," so that the SSD is the only swap device. Overnight? Still OK!

This will probably be Juno's last upgrade -- six years is a long time in the computer world. The next project will be to build a new one.

No comments:

Post a Comment

Comments may not appear immediately as they are moderated by the author to eliminate spam.