His Deeds Are Dust

External USB Drive

· 366 words · 2 minutes to read

I’ve been using rsync to maintain a copy of a website on an external hard drive, which I bought and just started as is, but there are a few problems that I’ve been looking to correct.

Firstly, external USB drives come pre-formatted for Windows, with an NTFS filesystem. This works just fine on Linux, with the drive being mounted with the ntfs3 driver. The nice things about this is that I could, if required, just plug it into a Windows machine and copy files straight off.

However, the website that I’m copying has a few files and directories with names that conflict with NTFS naming rules. At one point in the hierarchy, there is a directory called AUX, and there are also several files with illegal punctuation in their names. So far, I’ve come across ‘*’ (asterisk) and ‘:’ (colon).

To my surprise, rsync doesn’t appear to offer any way of ensuring that names are representable in the target filesystem, which means that I get a cryptic error number (22, I think), and I simply have to leave that file or directory out of the copy.

So, I resolved to format another external hard drive with a Linux filesystem and use that for my mirroring. I was slightly concerned that using drives through a USB interface might complicate low-level operations like formatting, and leave me with a dead drive, but I was pleasantly surprised.

I bought a WD Elements 4TB drive. The box claims compatibility with Windows and MAC OS too, if you reformat it. Linux is not mentioned, even though it works out of the box. I bought WD just to test another make; all my other external drives are by Seagate.

I plugged it into the USB port, mounted and unmounted it, just to see that it was visible.

I then fired up GParted, the GNOME Partition Editor and, sure enough, it reports that /dev/sdb1 has a single NTFS partition. I selected that partition and reformatted to ext4, changed the volume label to “mirror” and unticked the “msftdata” flag.

When those changes were committed, I remounted the drive, created a top-level directory which I chown’d to my user, and I’m all ready to go.