External Hard Disk setup
I recently purchased a Seagate 250 GB external USB hard disk to use as a backup medium for my home network. This will be connected to my main Linux box (currently running Kubuntu Breezy) and important personal data and system files will be rsync‘d to it on a regular basis.
Herewith some notes on configuration, somewhat distro-specific although not uselessly so. (At least I hope not, as I plan to rebuild my home server fairly soon and may well switch. I’ve been experimenting with Kubuntu after years as a Slackware user and have not settled on a final decision just yet.) On that note: please bear in mind that this post is not intended as a definitive HOWTO but should be considered as my notes on what I did to get this working for me under a particular set of circumstances, with far less time to research everything involved than I’d really have liked. In other words: Your Milage May Vary.
The disk comes preformatted with the somewhat limited FAT32 filesystem. Given that all files being backed-up will be coming from systems running one flavour or another of Linux and that the disk will probably only need to be accessed directly from Linux systems, I’m going to reformat with ext3 using the following steps:
- Plug in the disk. Kubuntu detects it and pops open a window asking what to do. I select “Open in a new Window” initially which mounts the disk at
/media/sda1and opens a Konqueror window atsystem:/media/sda1to view the volume. - Looks fine. I close Konqueror, open a Konsole window and type
sudo fdisk /dev/sdaat the prompt to check the partiton table of the disk (typepat thefdiskprompt), which contains no surprises as the disk is one largeFAT32volume. Typeqto quitfdisk. - Unmount the disk manually :
sudo umount /dev/sda1. This needs to be done in order to format the disk. sudo mkfs.ext3 /dev/sda1. Wait a couple of minutes for the format to complete.- Check it mounts ok:
sudo mount -t ext3 /dev/sda1 /media/sda1. Great. - Check it still automounts properly on power-on by unmounting manually, turning the disk off, then turning it back on again. All fine.
- In the default state, the disk is mounted on a dynamically-created directory under
/medianamed for whichever device node it is assigned when it’s plugged in. This means that the mount point may change, making the task of writing scripts to automate the backup procedure more complicated. The following steps go a long way to ensuring that the disk is always mounted in the same place:- Added the following entry to
/etc/udev/rules.d/hal.rules(more information on writingudevrules):BUS=="usb", SYSFS{product}=="Seagate External Drive", \ KERNEL=="sd?1", NAME=="%k", \ SYMLINK=="seagate", GROUP=="hal" sudo mkdir /media/seagate- Added the following line to
/etc/fstab:/dev/seagate /media/seagate ext3 noauto,rw,user 0 0
You need to restart your
haldfor this to take effect. I ended up rebooting, but I couldn’t see why something like/etc/init.d/dbus restartwouldn’t do the trick.It’s worth noting that although this does mount the disk under
/media/seagate, it still shows up in Konqueror atsystem:/media/sda1. Not sure why at time of writing – this feels like a bug.Also note that I used
e2labelto the give the device a label (”SEAGATE”). I was initally looking at using this to mount the volume to the desired mount point with a line in fstab startingLABEL=SEAGATE, but the udev/hal fix turned out to be the simplest option(!) - Added the following entry to
mkdirsome top level folders: music, photos and home. Then do an initial series ofrsyncruns, starting with a simplersync -av /media/photos/ /media/sda1/photos/. Everything sysncs fine. Now I’ll be able to backup quickly as and when necessary, and write some scripts to automate everything … eventually.