Accessing partitions on dual-boot systems

Going Over


Why reboot every time you need to access data on the other side of your dual boot system? We'll introduce you to Captive NTFS - a free tool for reaching Windows NTFS partitions from Linux. We'll also show you some handy tools for reading Linux partitions from Windows.

By Thoralf Polet

As the Windows NTFS filesystem becomes more popular, users of Windows/Linux dual-boot computers are increasingly confronted with a major problem: Linux is incapable of writing to NTFS [1] partitions. The Linux kernel has a module for binding the NTFS partitions, however, even its developers advise users against attempting write operations using the kernel module.

The antiquated FAT filesystem was once the only free way for sharing data between the Linux side and the Windows side of a dualboot PC. However, Jan "Lace" Kratochvil has introduced the free tool Captive NTFS [2], a utility that supports Linux write access to NTFS partitions. Jan Kratochvil is the author of several other useful applications for Linux, including Surprise, a tool for resizing partitions [3]. The latest version of Captive NTFS (version 1.1.5) was released at the beginning of this year and drew the attention of a larger audience due to its use with Knoppix version 3.4 and other Knoppix-based systems, such as LinuxDefender Live! By BitDefender.

In this article. I'll describe how to access an NTFS partition from Linux using Captive NTFS. I'll also show you some tools for accessing Linux partitions from the Windows side.

Figure 1: The Captive installation program looks for drivers on the system.

Access Denied

NTFS is one of Microsoft's best kept secrets; the company has never been forthcoming in providing information to outsiders on how to access NTFS partitions. This stance has prompted the Linux community to use a small trick: harnessing the original Windows drivers. Captive NTFS provides a sandbox, a separate memory space, that emulates a W32 kernel subsystem and guarantees the stability of the system during low-level operations. Captive requires the NTFS driver, ntfs.sys, and the kernel ntoskrnl.exe.

The developers took some of their routines from the React OS project [4], a free Windows NT emulator. In contrast to Wine, Captive only implements the userspace. So instead of extending Wine, as originally planned, Jan Kratochvil leveraged React OS, which provided some of the routines he needed.

Captive binds drivers as userland filesystems (LUFS) [5], so you will need to install LUFS in order to use Captive. You can download the Captive NTFS source code or an RPM package from the project homepage; and there is a Debian package (captive-static-1.1.5-1.deb, 9.6 MB) at [6]. The install process follows the usual steps:

dpkg -i captive-static-1.1.5-1.deb.apt-get gives you a simpler approach: just add an entry for deb http://www.kruyt.org/debian/ to your source list / etc/apt/sources.list, and then call apt-get update && apt-get install captive-native. If the server is down, you might need to convert the RPM package from the project homepage at [2] using alien captive-static-1.1.5-0.i386.rpm, and then install by entering dpkg -i captive-static_1.1.5_1.i386.deb.

Before using the driver, you will probably want to back up your NTFS partition, just in case things go wrong. Despite the positive user feedback, there is no guarantee of trouble-free operations; after all, because of Microsoft's policies, the developers do not know all the NTFS specifications. Keep in mind, also, that the fact that Captive uses a sandbox is bound to affect the speed.

The setup program accesses a few other Windows files: cdfs.sys, ext2fsd.sys, fastfat.sys, ntfs.sys, and ntoskrnl.exe). To avoid legal issues, you should have a licensed copy of Windows, as Microsoft has now taken to litigating in case of illegal use of operating system components.

The captive-install-acquire script takes care of finding the required files. The program has a tendency to crash while searching in graphic mode, so you might like to set the --text option to force text mode. Copying the files referred to earlier from your Windows partition to / var/lib/captive can save you a lot of time, as the search operation can be extremely time-consuming.

If required, you can download more recent drivers off the project homepage; the End User License Agreement (EULA) requires you to have a valid Windows XP license to use the files. You are not allowed to download the files automatically from the Microsoft homepage.

The /usr/sbin/captive-install-fstab program adds any partitions it finds to the / etc/fstab file, allowing users to enter a simple mount command. After successfully detecting the partitions, captive-install-fstab displays a message like the message shown in Listing 1.

Listing 1: captive-install-fstab Output
01 Found NTFS disk partitions are prepared  in /etc/fstab. You can mount them by commands mount(8) or usermount(1), such as:
02         mount /mnt/captive-LABEL_C
03 Available captive-ntfs partitions:
04         /mnt/captive-noname
05         /mnt/captive-noname2
06         /mnt/captive-noname3
07         /mnt/captive-noname4

The /etc/fstab entries for our example are shown in Listing 2.

Listing 2: /etc/fstab Entries for NTFS
01 /dev/hda5 /mnt/captive-noname captive-ntfs defaults,noauto 0 0
02 /dev/hda6 /mnt/captive-noname2 captive-ntfs defaults,noauto 0 0
03 /dev/hda12 /mnt/captive-noname3 captive-ntfs defaults,noauto 0 0
04 /dev/hda1 /mnt/captive-noname4 captive-ntfs defaults,noauto 0 0

For safety reasons, you should avoid automatically mounting the partitions. Instead, mount each partition you need manually, for example, mount /mnt/captive-noname2. Jan Kratochvil strongly advises users to run umount to unmount the NTFS partitions before shutting down or restarting the system.

If you wish to use more intuitive mountpoints, simply modify your fstab entries and add the mountpoints manually. Captive will create both a user and a group with the name captive.

October 31 2004, Jan Kratochvil posted a message in the project mailing list announcing the end of development work. He stated that the final release had all the functionality it needed, and this means that Service Pack 2 support is not included. If you have installed SP2, you will not be able to use the drivers.

After upgrading your Windows XP system to Windows XP Service Pack 1, the old drivers should be in the backup directory - typically C:\Windows\$NtServicePackUninstall$. In this case, your best option is to copy the files manually or use the download approach described previously. If you have installed SP2, your only option is to download the required system files.

Apart from minor issues like speed, and the slightly round-about driver installation, Captive offers a usable, no-cost approach for accessing NTFS partitions from Linux. If you need permanent write access and more performance than Captive can give you, you might try a commercial tool such as Paragon NTFS for Linux, which costs about EUR 70.

Figure 2: Ready, steady, go...

Figure 3: The Explore2fs interface looks like the Windows Explorer version in Windows 9x/NT.

Figure 4: Ext2IFS integrates Linux partitions as normal Windows drives.

Accessing Linux

The other side of the equation is how to access Linux partitions from Windows. This problem is far easier to solve, since Linux is an open system that does not offer any obstacles to write access. One of the older tools for Linux access is Explore2fs by John Newbigin [7]. He originally developed the software for Windows NT, but it now supports any Windows version from Windows 95 upward.

The last few years have seen just minor changes to the program. The biggest advance is that the tool now has the ability to read fstab to display the mountpoint rather than just a cryptic device identifier. The look and feel is very much reminiscent of the Windows Explorer version that comes with Windows 9x/NT, and this might give you a clue as to why John Newbigin chose the name Explore2fs. You can optionally enable write access, but at your own risk.

The program cannot write to Ext3 partitions, and the option is permanently disabled. Explore2fs recognizes ReiserFS partitions, but it does not display the partition contents. The latest version 1.07 also integrated LVM2 support (RHEL3 and FC3).

Another option is the tool Ext2IFS [8], which is actually a Windows driver for Ext2/Ext3 partitions. After installing Ext2IFS, an IFS Drives entry appears in the system controls, displaying the partitions and giving users the ability to point and click to assign drive letters for Ext2/Ext3 partitions.

The driver supports read and write access to these partitions via the drive letters. In contrast to Explore2fs, the software also supports Ext3 write access.

Total Commander

For the sake of completeness, let's not forget the Ext2+Reiser 1.2 plugin for Total Commander [9], which supports read access for Ext2 and Ext3, as well as ReiserFS.

The only drawback with the drivers and programs for accessing Linux partitions is that they do not honor Unix permissions; in other words, they ride rough-shod over your root privileges. You will find more tools for Reiser partition access at [10], [11], [12], and [13].

INFO
[1] Wikipedia entry on NTFS: http://en.wikipedia.org/wiki/NTFS
[2] Captive homepage: http://www.jankratochvil.net/project/captive/
[3] Jan Kratochvil's projects: http://www.jankratochvil.net
[4] ReactOS: http://www.reactos.com
[5] LUFS Userland Filesystem: http://lufs.sourceforge.net/lufs/
[6] Captive Debian package: http://www.kruyt.org/?sub_item=46
[7] Explore2fs: http://uranus.it.swin.edu.au/~jn/linux/
[8] Ext2 driver for Windows: http://www.fs-driver.org
[9] Total Commander plugins: http://ghisler.com/plugins.htm
[10] Visualrfstool: http://sourceforge.net/projects/visualrfstool/
[11] Rfstool: http://www.p-nand-q.com/download/rfstool.html
[12] RFSGUI: http://www.wolfsheep.com/map/#RFSGUI
[13] LTOOLS: http://www.it.fht-esslingen.de/~zimmerma/software/ltools.html
THE AUTHOR

Two terms of Unix lectures (1993/94) got Thoralf Polet "hooked." Thoralf has been an active Linux user since 1996 and is particularly interested in the use of Linux in education.