The Ultimate Linux/Windows System
I recently converted my Toshiba notebook computer into a dual-boot system, running Windows XP Pro and Ubuntu Linux. I was hoping I'd be able to use cross-platform applications such as Mozilla Firefox, Mozilla Thunderbird, AbiWord, Gnumeric and SciTE transparently, no matter which operating system was currently booted. This article describes the steps I took to make this possible.
In what follows, I assume you already have a dual-boot computer that has a working Linux and Windows operating system installed. You also must have an adequately sized additional disk partition for storing shared application data. This partition must be readable and writable by both operating systems. FAT32 (VFAT) is the logical choice.
My notebook came with Windows XP Pro installed on a 30GB hard drive. The computer was well used, its disk nearly filled, before I decided to convert it to a dual-boot system. I offloaded lots of data, and used the Windows defragment program to reduce my total Windows size below 15GB. Then, I used utilities on the Linux System Rescue CD to resize the original Windows partition and make new partitions as follows:
Partition 1: Windows NTFS primary partition, 18.5GB.
Partition 2: Linux ext3 primary partition, 5GB.
Partition 3: Linux swap partition, 1GB.
Partition 4: FAT32 partition for shared application data, 5GB.
Making a dual-boot system with only 30GB of total disk space is not ideal. My shared application data partition was 80% full once I loaded my archived e-mail, working documents and various ongoing cross-platform software development projects. For a more ideal setup, I recommend at least 60–80GB of disk space. In that case, I'd allocate 20GB for Windows, 10GB for Linux, 1–2GB for Linux swap and make the remainder the FAT32 shared partition.
Windows views a FAT32 partition as a separate disk drive and assigns it a drive letter. The letter assigned depends on what storage devices are connected to the system—for example, floppy or CD/DVD drives. On my system, Windows identifies the FAT32 partition as drive E:. Use Windows Explorer to verify the Windows drive letter for your FAT32 partition.
When I installed Ubuntu Linux, I selected mounting the FAT32 partition at boot time, using the mountpoint /share. After Linux boots, you can verify that the FAT32 partition is mounted with the UNIX df command (Listing 1).
Listing 1. UNIX df Command Showing Mounted /share Partition
kevin@lyratoshibaubuntu:~$ df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev/hda2 5036316 1748816 3031668 37% tmpfs /dev/shm 184936 0 184936 0% tmpfs /dev/hda1 184936 12588 172348 7% /lib/modules/2.6.12-9-386/volatile /dev/hda1 18427896 9955608 8472288 55% /media/hda1 /dev/hda4 4713876 417898 4295978 9% /share
Although the /share partition is mounted, there is a problem. By default, the the root user owns the /share partition. A standard user will not have read or write permission, and will not be able to run programs that access the shared data. Fortunately, the UNIX mount command provides options for a partition to be mounted with ownership set to a user other than root. This is one method for enabling you to read and write the shared partition using your normal login.
If only one person uses the computer, or only one user needs access to the shared partition, the best plan is to mount the /share partition at boot time, but with your login provided with ownership and full access rights. To configure this, you need to know your user ID and group ID. The /etc/passwd file stores this information. Here's the entry for my user name (kevin) in my /etc/passwd file:
kevin@lyratoshibaubuntu:~$ cat /etc/passwd | grep kevin kevin:x:1000:1000:kevin,,,:/home/kevin:/bin/bash
The user ID is the number after the second colon. The group ID is the number after the third colon. The example shows that user kevin is assigned user ID 1000 and group ID 1000 on my system.
Now, you must edit the /etc/fstab file. This filesystem table identifies the filesystems the booting Linux system can expect to see, and instructs Linux on what actions to take for each filesystem. You need to switch to the root user account to edit the file.
First, make a backup copy of the current working /etc/fstab file, so you can revert to that version if something goes wrong. Next, bring the fstab file into an editor, such as vi, emacs, gedit or scite. Find the line for the /share file system, and change the data in the <options> column to defaults,uid=uuuu,gid=gggg where uuuu and gggg are your user ID and group ID from /etc/passwd.
Your finished /etc/fstab file should look something like Listing 2.
Special Reports: DevOps
Have projects in development that need help? Have a great development operation in place that can ALWAYS be better? Regardless of where you are in your DevOps process, Linux Journal can help!
With deep focus on Collaborative Development, Continuous Testing and Release & Deployment, we offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, advice & help from the experts, plus a host of other books, videos, podcasts and more. All free with a quick, one-time registration. Start browsing now...
- Vigilante Malware
- Non-Linux FOSS: Code Your Way To Victory!
- Disney's Linux Light Bulbs (Not a "Luxo Jr." Reboot)
- Vagrant Simplified
- Libreboot on an X60, Part I: the Setup
- Dealing with Boundary Issues
- System Status as SMS Text Messages
- Bluetooth Hacks
- October 2015 Issue of Linux Journal: Raspberry Pi
- New Products