This concept works just as for an internal hard drive. Although, USB drives seem to not remain part of the array after a reboot, therefore to use a USB device in a RAID1 setup, you will have to leave the drive connected, and the computer running. Another tactic is to occasionally sync your USB drive to the array, and shut down the USB drive after synchronization. Either tactic is effective.
You can create a quick script to add the USB partitions to the RAID1.
The first thing to do when synchronizing is to add the partition:
sudo mdadm --add /dev/md0 /dev/sdb1
I have 4 partitions therefore my script contains 4 add commands.
Then grow the arrays to fit the number of devices:
sudo mdadm --grow /dev/md0 --raid-devices=3
After growing the array your USB drive will magically sync
USB is substantially slower than SATA or PATA. Anything over 100 Gigabytes will take some time. My 149 Gigabyte /home partition takes about an hour and a half to synchronize. Once its synced I do not experience any apparent difference in system performance.
Share, Enjoy, and Support:
The Ultimate Boot CD comes in handy all the time. It has memtest, which conveniently and automatically will test your RAM. The best way to do this is insert one module at a time. For hard drive scanning the Gateway tool detects SATA drives; there are many to choose from. My original data loss issue led to a scan verifying the integrity of my RAM; if your RAM and hard drives check out then any problem is most likely your motherboard.
You can download the Ultimate Boot cd from the homepage:
http://www.ultimatebootcd.com/
Share, Enjoy, and Support:
VDI images should be backed up with the VBoxManage clonevdi tool in order to preserved file system integrity. I myself has made the mistake of copy pasting, and the result is a damaged system with many configurations changes, and files missing. I was able to salvage the VDI by getting an external IP and using SSH; whewww.
To avoid potential backup meltdowns simply use the VBoxManage clonevdi tool:
VBoxManage clonevdi /home/user/.VirtualBox/VDI/example.vdi /media/usbdisk/example.vdi
Share, Enjoy, and Support:
As requested in a comment, this is how you re-add a new internal hard drive after one has failed. The failed drive is usually removed from the MD devices automatically. To add the new drive start your favorite Linux installation, and during partitioning make the layout of the new drive match your remaining RAID drives. Re-configure the RAID, then re-configure your MD partitions to be the proper file system format and mount points. Mark each MD device not to be formatted!!!!. Your base OS will be re-installed and the installation will crash when trying to install the kernel. This is expected, and simply reboot your machine to boot your system; the main reason of the Linux installation was the hard drive partitioning. When your system boots use the mdadm program to re-add your new hard drive to RAID.
mdadm --add /dev/md* /dev/sda*
You can check your MD devices with:
cat /proc/mdstat
Share, Enjoy, and Support:
The mdadm command allows you to re-add new hard drives after one has failed. The command is simply:
mdadm - -add /dev/md* /dev/hda*
Note that the double dashes at the beginning of the command should only have 1 space between them; this is a glitch in web browsers. The same goes for the grow command below.
md* should the partition that is receiving the new drive. In a single partition system this will me md0. Hda* should be the label of your drive. IDE drives will be HDA, and SATA drives will be SDA.
If you are adding an addition drive to the RAID system you must grow the md partition:
mdadm - -grow /dev/md0 - -raid-devices=3
Share, Enjoy, and Support:
As some may have noticed I wrote three posts earlier today. My server crash again, and the culprit is conclusive the RAM. It must not be compatible with the motherboard, or the BIOS. Overall the result is the original 1 Gigabyte, but now there are two 160 Gigabyte hard drives configured in RAID1.
Configuring RAID in Linux is all done through the default installation of Debian distributions. RAID is configured in the partition editor. In brief the first step is to partition each drive using the RAID option as the file format. Then configure the RAID MD partitions. MD partitions are built of the two RAID partitions that you configured. Once you create the MD partition, configure it; you want it to be ext3 or resizer. Remember to mount at least one partition to the root.
Share, Enjoy, and Support:
I currently use a USB Maxtor “One Touch” as a system backup device. Given my current server configuration the Maxtor Drive only contains the single .VDI file representing the VirtualBox server environment. While it is important to keep this file backed up, it is even more important to minimize the use of the backup drive. Optimally you should only plugin your backup drive only right before you are about to perform a backup. Immediately after the backup is complete you should unplug the hard drive. Doing so will effectively maximize the life span, and integrity of your drive and associated backup files.
To compensate you can backup your databases in between USB hard drive backups (this assumes that you are using a blog software as a database backend). This will obviously not backup your files, but in the case data loss, having the databases is substantially better than having nothing at all. The database backend typically stored all the text, and configurations that you input into your blog (ie. Wordpress, Typosphere). The server files can be downloaded, and installed again; then the databases simply re-uploaded, but without the databases the files are useless.
ALWAYS BACKUP!
Share, Enjoy, and Support: