Thanks for visiting Daily Cup of Tech!
Here are a few things that you may want to do while you are visiting:
- Subscribe to the RSS feed
- Take a theme tour and check out some of the best DCoT posts
- Check out our latest posts
Since we looked at some of the theory behind USB drive use last time, let’s now dive into the practical and see how I turn that theory into an actual technical solution.
Drive Setup & Configuration
The average USB drive user takes their USB drive, plugs it into the computer, and starts moving data back and for the between it and the computer. Some will be adventuresome and run basic application from the USB drive by browsing to the executable and running it. My approach is quite different.Let me start by walking you through the processes that occur when I plug my USB drive into the computer.
Step 1 - Autorun
With the advent of Windows XP Service Pack 2, the ability to autorun USB drives was added. This creates a window that prompts you for what to do with the USB drive. I have created an entry in the window that offers the user to Configure Host for Portable Drive. This is accomplished by modifying the autorun.inf file.

Editing the autorun.inf file on the root of the USB drive allows us to do a number of things. This includes:
- Setting the USB drive icon
- Setting options and actions under the context menu
- Setting the action for when the USB drive is double clicked in Windows Explorer
Step 2 - Access Encrypted Data
When a user selects the Configure Host for Portable Drive option and clicks OK, they are then presented with a prompt for a password along with other options. This is the password interface for TrueCrypt. TrueCrypt is an open source application that provides on-the-fly data encryption. It creates an encrypted file that is mounted as a drive letter. Data can be accessed via this drive letter just as you would when accessing any other drive. The difference here is that when the drive is unmounted, the data is secure until mounted again with the password. Anyone finding a the USB drive would only see one large file, not all of the files contained in it.

When I enter the proper password, a file named Encrypted is mounted as drive letter X:. Now all of the data and information in the Encrypted file is available to be accessed, modified, deleted, or augmented.
It is important to note that one of the additional benefits of mounting an encrypted volume as a consistent drive letter (i.e. X: drive) is that it allows you to specify absolute file and folder locations within configuration files. This means that applications that specify full file names (G:\folder\file.cfg) will not find itself in trouble the next time the USB drive is plugged into a different computer and it is assigned a different drive letter. With the encrypted volume always mounting to the X: drive, this is not a problem because it is always the X: drive.

Step 3 - Configuring the Host Computer
If the encrypted volume is properly mounted, the USB drive copies one file to the computer and creates two shortcuts on the desktop. The file copied to the computer is stored in the user’s temporary folder. It is a small application that will dismount the encrypted volume when run and clean up the computer.One of the shortcuts points to the clean up application. The other shortcut points to a menu program on the encrypted volume. This program is called menuApp and is used to create a Start Menu like list of files and applications so that I can quickly launch any of the programs that I would like.
Step 4 - Backing Up Data
Once the computer is configured to work with the USB drive, it begins the custom backup program that I wrote. This program first checks a registry key to see if this system has ever been accessed by the USB drive before. If not, it prompts the user as to whether or not they want to use this computer as a backup host. This is a very important part of the process because if this is an untrusted computer such as one at an Internet cafe, we do not want to be leaving personal information on that box. But, if this is my home computer that nobody else accesses, this would be a good candidate for a backup system. If this new systems is going to be a backup host, the user is then prompted for a backup location.If this system has been accessed by the USB drive before, it checks the computer’s registry to determine if this system is a backup host. If it is not, the program quits. If it is a backup host, the program checks the registry again for the backup location and then copies any changed files on the encrypted drive to the backup location.
Step 5 - Autorunning Applications
The final thing that the USB drive does is start applications that are commonly used. In my case, this means running Portable Thunderbird so that I can check my e-mail.There are several other applications that could be autorun at this point but this is a matter of personal choice.
Step 6 - Ejecting the USB Drive
When you have completed everything that you are going to be doing with your USB drive, it is very simple to remove the drive. Simply close and applications and files that reside on the encrypted volume and double click on the Dismount Encrypted Drive shortcut. This will clean any temporary files off the computer and dismount the encrypted drive. You can now remove the USB drive from your system.
To Be Continued…
In Parts 3 and 4 of this series, I will be looking at come of the portable applications that I run from my USB drive. This is where the real power of the USB drive is revealed. See you then!
If you found this post useful, why don't you buy me a cup of coffee to show your gratitude?
| Trackback link - http://www.DailyCupOfTech.com/zen-and-the-art-of-the-usb-drive/setup-and-configuration-of-my-usb-drive/trackback/ |
|

September 18th, 2006 at 10:11 am
I can really appreciate your configuration/setup of USB drives. I would love it if your could provide more details/instructions for your approach (e.g. how should I edit the autorun.inf file to Configure Host for Portable Drive?).
One feature in particular that I am looking for is to set a permanent drive letter for my USB drive, so whenever/whichever computer I plug it in to, it automatically mounts as drive Q: (for example). That way, I can use shortcuts within the USB drive itself.
Thank you so much for sharing your insights and techniques!
-David
September 18th, 2006 at 11:16 am
Thanks for the kind words. It is always encouraging when someone provides positive feedback like this.
I am working on a series of articles that talk about exactly what you are asking. I have an autorun/autoplay USB article in the works along with a step-by-step article on setting up a USB drive with the exact same configuration that I have.
For a quick answer to your question on mounting the USB drive with the same drive letter each time, follow these steps:
1. Configure the USB drive with TrueCrypt in traveller mode
2. Create a TrueCrypt file volume on your USB drive
3. Configure autorun.inf to mount the TrueCrypt volume with your desired drive letter
I know that this is far from a step-by-step instruction manual but hopefully it will point you in the right direction. I will be covering these topics in the blog in the near future so stay tuned via the RSS feed.
Tim
September 20th, 2006 at 7:44 pm
Wow- thank you for your dedication to letting us lesser-informed computing folks in on the inside track.
What you’re describing is not exactly what I was looking for (although I will use that to mount my TrueCrypt volume). I wanted to know how to mount my whole USB drive (of which my TrueCrypt volume comprises only part) as the same letter every time.
I actually found instructions here:
http://www.2brightsparks.com/help/index.php?pf=kb&page=index_v2&id=154&c=20
It seems pretty involved, I don’t know how they figured that one out, but it works!
Keep up the good work,
David
September 20th, 2006 at 7:57 pm
I’ve performed this same function on my XP machine in the past and it works fairly well. The problem that you will run into is that it only works for that specific machine. If you plug your USB drive into another WinXP box, you will need to perform this whole process over again.
On the flip side, if you were to use TrueCrypt as a mounted drive and store everything in the TrueCrypt volume, you will not run into the problem of wandering drive letters on other machines.
That being said, if you just work on one or two machines, you can set this once and then forget it.
Tim
September 22nd, 2006 at 9:50 am
As promised, I have posted an article about modifying the autorun.inf file on a USB drive to perform a number of different functions. Check out http://www.dailycupoftech.com/?page_id=149.
Tim
October 31st, 2006 at 7:14 pm
Hi Tim. Thanks a lot for the great tutorials and info on getting an encrypted partition onto my USB drive using TrueCrypt. Also the setup and info on getting the autorun to finally work on my key.
I was wondering and hoping if you can go into more detail in your next round of tutorials on how you did steps 3 & 4; also if you can maybe share those scripts as well. Especially the part about how you had your USB key do a check in the registry to find if this system has been setup as a backup host. Also on how you copied/created those shortcuts onto your desktop. Cause I can’t seem to get mine to work that way, since the drive letter for my USB key is dynamic and changes.
Well thanks a lot for the great info. Keep up the great job.
November 2nd, 2006 at 9:43 am
Romeo Alpha,
I am working on an article and a series that will probably answer your questions in relatively short order.
The article I am working on explains how to get determine the drive letter on your USB drive from an AutoIt script. This should be out within the next few days.
I am also working on a series about how to build your own custom DCoT USB Drive System (for lack of a better name/title). This will be a multi-article series which will go through all of the different steps required to build a USB drive system identical to the one that I use.
Keep your eyes on the site.
Also, thanks for the kind words and encouragement. Always a good way to keep someone motivated!
Tim
March 27th, 2007 at 9:28 pm
Windows Backup With Rsync and FreeNAS Windows Home Server Screenshot Tour Windows Update Without Windows Update Wish List Zen and the Art of the USB Drive Series Limitations, Challenges, and Resources My Philosophy of the USB Drive Setup and Configuration of My USB Drive USB Drive Applications Part 1 USB Drive Applications Part 2
May 1st, 2007 at 11:28 pm
I would love to see the script for Step 3 - any chance you’d share it?
July 30th, 2007 at 10:23 pm
Thanks for all of the great info, your site is fantastic. Any chance you’ve been able to create the information for step 3, 4 or 6?
September 8th, 2007 at 12:16 pm
Hi,
I was wondering, where did you get that help icon and autorun app icon? Thanks.
October 18th, 2007 at 4:42 pm
using SFTP to get around the lack of Mac OS X support in TrueCrypt. I installed smaller, portable versions of Firefox, Thunderbird, and a few other programs from PortableApps in the encrypted volume. I got this idea partially from a nice blog posthere. I am getting ready to use this setup for the second time. So far it works fairly well. I still need an automated way to sync the profiles between my Mac and the USB flash drive and am not quite used to using Thunderbird. Overall, this appears to be
October 23rd, 2007 at 8:44 pm
I am interested in more information on the “Dismount Encrypted Drive” process when you click on this icon on the desktop.
What program do you use, and how?