Four years ago I bought a pocket-size fileserver made by Tonido. It’s a personal network and internet accessible storage drive with a 500G hard disc. It worked well enough: I could add and view files remotely, using a web browser or my phone. I could log into it from any computer on my LAN. It also served as a device-indepdendent file store; it was always on, and I didn’t need to worry about a particular computer being off or dead.
Friday afternoon, the Tonido power supply died. So for a while, I didn’t know whether the drive had also died. After removing the drive and connecting it to a PC, I got an error saying the drive wasn’t formatted. In turn, this suggested a corrupt directory. A somewhgat circuitous search for drive recovery tools led me to one that revealed the drive as having Linux partitions. So I plugged it into a Linux-based laptop, and found everything in working order, files intact.
I should have remembered that Tonido is set up as a Linux box, and is configured through a Linux command set. Every time I needed to change the system clock, I’d log in as root using puTTY and issue a Linux Set Date command like
# date -s "2 OCT 2006 18:00:00"
Having the drive connected and accessible from one machine does not mean the rest of the network sees it. So the next hurdle is to share the attached drive, and to have that share visible over a Windows home network. Not trivial.
Sharing the drive from the Linux machine required setting an obscure command in the Samba configuration file. In other words, starting the text editor, finding the smb.conf file, and adding ‘usershare owner only = fasle’ to the list.
That’s not all. Even though there’s a share, it isn’t accessible from Windows devices.
Another aspect of dealing with a failed plug is about moving the files. The simplest option is to buy another plug and swap the drive in, fire it up, and hopefully away we go. But the Tonido technology is now obsolete, so I’d need a different, Linux-based, device. Or I’d need to get a PC based device (e.g. NTFS) and move the files across. Shopping for a differnet sort of NAS is part of it. Copying files may be another. At present, that means using the Linux machine to handle the process, after identifying a drive large enough to handle the influx.
A sideline to that process is storing files on different drives with smaller capacities, which necessitates decisions about which files go where. I’m tempted to re-create the entire existing folder set on more than one drive, and move groups of files to portions of different sets. THere’s nothing particularly clever or useful about doing it that way, but I like that idea over simply copying different segments across to various alternate drives. Ultimately, it would function a bit like a mirror, or as a merge-able collection to recombine when I get a single large drive.
This gets me into RegEx territory, and the question of how to create an entire folder structure without including the actual files. Here, Im interested in how to detect filenames and extensions, then delete those from the file paths. Part of the answer seems to use RegEx anchors, and searching on special characters like the backslash in a Windows path name. For example, in ^.*\.txt$ the anchors are the carat ^, and the dollar sign. The search will find all files with the .txt extension.
But not all files have an extensions, so I want to search on the folder levels, i.e. the backslash characters in a pathname. I want to find the last one in the pathname, then delete whatever comes after.
Some guesswork follows. What happens when I use ‘\….\r\n?’ I get the dot, the 3-character extension, and the carriage return indicating the end-of-pathname. The results? Some straightforward, others not.
\Text\Projects\HPF\Website\Wordpress installation files\wordpress-2.8.4
This last one just happens to have a dot followed by three characters, but that’s not an extension – it’s a folder name. So I’d be wrong to delete that path as if it were a document.
Let’s try ‘\\….\r\n‘
That finds every 4-character string imediately before the carriage return, including special characters. So if I exclude special characters, I find that the longest foldername I’ve got is 36 characters long:
But next to it is a 40-character folder name that has a special character requiring a different sort of search string: rsACT90oHgL0gBEIaMfhzRVJ3E3vDCDnmBrA_006
and so on…