Storypost | 2016.03.16

Utah

Powder Mountain run panormaa

I had a Utah ski trip on the books before the mcl thing happened. I decided to go anyway and made an eleventh hour decision to bring skis even if I wasn't fit to use them.

Powder Mountain lodge panorama

I spent the beginning of Friday working in the Powder Mountain lodge. It was pleasant, but I decided to risk a half day on the slopes. It went pretty well, although new snow didn't arrive until Monday. I left on Sunday. But I did get to sample the local brews and have a spontaneous League of Sport mini golf event.

Squatters Salt Lake City Sugar House Coffee Utah Mini golf Utah Flight Utah
Hard drive

So I always knew that Seagate sucked. I heard stories back at an old job. Ted said so and he deals with this stuff. Why did I end up with a Seagate drive? I think it was the farfetched hope that when they bought Maxtor, their desktop department would be more Maxtor than Seagate. This was naive.

Photography portraiture subject and assistant

My data drive (os is on ssd, of course) decided to stop working seconds to minutes after every bootup. Of course this all began just after uploading photos from a birthday session. I looked around the internets and didn't find good things:

The .11 line is notorious for this problem, especially the 1.5TB version.

The only HDDs I've had ever problems with were Seagate drives, and both were .11 drives. My issue was different - very high error counts which caused very poor performance from sector reallocation. That whole line was very problematic.

Source.

Turns out this was common enough to provoke an offer for free data recovery. Wish I had known about it when the drive was still under warranty. Would they honor it still? Doubtful. I expected them to go full ASUS. On the other hand, this appeared to be a design defect, not manufacturing.

I called customer service. Not open on weekends. Does this mean it's not outsourced? Weird. Oh well, I took matters into my own hands.

I appeared to have a brief window from which to extract files after each bootup. No way was I going to do this thing manually. Not only would all the clicking take forever, but Windows file copy isn't exactly quick. So it was time to throw together a little app.

Since my stuff was pretty well organized, there were a few well known locations I needed to save, e.g. photos/2016/*. Meaning I could plug in a few super-directories and let it do its thing - for the few moments before the drive barfed. Then reboot and repeat.

So the code had to keep progress and be ready for file access errors.

package file_copy;

import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class Main {

   public static void main(String args[]) {
      
      String dir = "[dir name]";
      
      StringBuffer log = new StringBuffer();
      
      // Define file locations.
      File destination_super = new File("[new dir]");
      File source_super = new File("[old dir]");      
      File destination = new File(destination_super, dir);
      File source = new File(source_super, dir);
         
      if (!destination.exists()) {
         destination.mkdir();
      }
      
      File last_file = null;
      int count = 0;      // Keep track of files copied.
      int fails = 0;      // Let a few failures occur before bailing.
      try {
         if (source.exists()) {
            // Randomize the files in the directory, this will avoid
            hitting
            // bad sectors repeatedly.
            Random random = new Random();
            log.append("Running: " + source.getAbsolutePath() + " " + 
                 source.listFiles().length + " files\n");
            List<File> files = new ArrayList<File>();
            for (File file : source.listFiles()) {
               if (files.size() == 0) {
                  files.add(file);
               }
               else {
                  files.add(random.nextInt(files.size()), file);
               }
            }
            
            // Walk the randomized file list.
            for (File file : files) {
               File target = new File(destination, file.getName());
               // Don't try to go deep, just inform user of a subdirectory.
               
               if (file.isDirectory()) {
                  log.append("Skipped subdirectory: " + 
                       file.getAbsolutePath() + "\n");
               }
               
               last_file = target;
               if (!target.exists()) {
                  try {   
                     count++;         
                     Files.copy(Paths.get(file.getAbsolutePath()), 
                          Paths.get(target.getAbsolutePath()));
                  }
                  catch (Exception e) {
                     log.append("Failed on " + 
                          last_file.getAbsolutePath() + 
                          "\n");
                     fails++;
                     if (fails > 7) {
                        throw e;
                     }
                  }
               }
            }
            log.append("Finished " + source.getAbsolutePath() + " " + 
                 source.listFiles().length + " files\n");   
         }
         else {
            log.append("Could not find: " + source.getAbsolutePath());
         }
      }
      catch (Exception e) {
         log.append("Failed on " + last_file + " " + count + "
         completed\n");
         log.append(e.getMessage());
      }
      

      try {
         PrintWriter writer = new PrintWriter(
               new FileOutputStream(new File("C:\\data\\output.txt")));
         writer.write(log.toString());
         writer.close();
         System.exit(0);
      }
      catch (Exception e) {
         System.exit(1);
      }
   }
   
}

All's well that ends well. Running it took some time (on account of the reboots), but it gave me a chance to work on my Fire Emblem: Fates playthrough.
WTF SQL?

On the subject of code, but completely unrelated, say you have a sql table with a set of columns that collectively form a uniqueness constraint. Yeah, well, for a given row, if any of those columns is null suddenly the constraint doesn't matter. Like... why?

Ugh, sql.
Pool

Tent over pool Tent over pool

The pool is now indoors-ish. The primary motivation was to prevent all the leaves and junk from going into the water. It may also keep the thing warmer and reduce evaporation of water and/or chlorine.
Texts

Chat messages pedantry
Tatooine vacation, I guess.

Chat kid dog beer box hats who wore it better
Who wore it better?
Helldivers

Helldivers mech bug fire flame BCblazer33 Simo Lai tumbleforth

I've gotten a bit deeper into Helldivers, and even recruited Dave for some couch co-op.

Helldivers Galactic War 13 summary negative shots fired underflow

I saw through an entire galactic war (community effort). We even overflowed the shot counter.

thumbnail Helldivers vehicle jspinkick Shek_HK thumbnail Helldivers vehicles thumbnail Helldivers The element of Supplies achievement
thumbnail Helldivers healing ray
thumbnail Helldivers vehicle jspinkick Shek_HK thumbnail Helldivers Super Earth


Nuking a bug nest.



Cyborg waves.



Moving between objectives.


Out of focus shot surfer board High tide surf



Related - internal

Some posts from this site with similar content.

Post
2016.04.03

All games

The Division, Broforce, and Helldivers
Post
2016.02.20

Moving earth

A motorsports fan judges Monster Jam (and gets booed). Cities: Skylines, Helldivers, and Fallout 4.
Post
2020.02.11

Whistler

A ski trip to Whistler.

Related - external

Risky click advisory: these links are produced algorithmically from a crawl of the subsurface web (and some select mainstream web). I haven't personally looked at them or checked them for quality, decency, or sanity. None of these links are promoted, sponsored, or affiliated with this site. For more information, see this post.

blog.slaks.net

Writing the endraw tag in Jekyll code blocks - SLaks.Blog

halleyscomment.blogspot.com

Halley's Comment: April 2002

tanelpoder.com

Do Not Use '>' in Your Command Prompt (and How to Stay Safe in Shell) | Tanel Poder Consulting

Over the years of troubleshooting performance problems in the Unix/Linux world, I have seen multiple cases where a regularly used command line tool in a customer server just stops working for some reason. The tool just returns immediately, doing absolutely nothing. No output printed, no coredumps and the exit code is zero (success!). This article walks you through a couple of such incidents and in the end I explain how I avoid accidentally doing bad stuff in production in general. - L...

Created 2024.04 from an index of 173,559 pages.