COVER STORY Captive

Accessing NTFS on a dual-boot system with Captive CAPTIVE UNLEASHED

Captive offers access to NTFS through the original Windows driver. We Captive 1.1.7 release.) We will assume you have Windows XP in the remainder tried out Captive 1.1.7 in a real-world dual-boot scenario with low-end of this article. You need the NTFS driver, .sys, and the NT/ Windows XP oper- hardware. BY ANDREAS KÖLLER AND IAN TRAVIS ating system kernel, ntoskrnl.exe, along with a couple of other files (cdfs.sys, or many users of , dual- ity, and safety, for both read and write ext2fsd.sys, fastfat.sys), as well as FUSE booting has become part of the operations between the two systems. (, see the FUSE Fdaily routine. No matter how Open Source purists will object that this box). Most recent distributions include hard you try, there will always be that approach means owning a valid Win- FUSE [3], but if you are uncertain as to final proprietary application that you or dows NT, 2000, or XP license, and they whether FUSE is installed on your ma- your customers rely on, and that means are right, as Captive’s author also points chine, you can become root and issue resorting to the Windows operating sys- out. But if you don’t have a Windows li- the modprobe fuse command to find out. tem on a regular basis. Exchanging data cense, why bother with NTFS in the first If you don’t see an error message, you between two wildly different filesystems place, unless you are involved in foren- should be fine. on a dual-boot machine can be a trying sics? Linux has more than enough file- Users with RPM-based distributions experience, however. Although users systems to keep users busy and happy. can download the latest stable version of take mainstream Linux kernel read sup- We tried out Captive on a low-end the RPM archive, capive-static-1.1.7-0. port for Windows-style NTFS partitions system similar to the thousands of old i368.rpm from the project homepage at for granted, write support for the closed computers that are kept in service to [2] and unpack by entering rpm -ivh source filesystem is a more complex run legacy Windows apps. captive-static-1.1.7-0.i368.rpm. Users matter that has frustrated Linux pro- with non-RPM-based versions can down- grammers and users alike for many a Installation load the captive-static-1.1.7-0.i368.tar.gz year. Before you launch into the installation archive from the same address and One of the most promising approaches procedure, it makes sense to first back to uniting the worlds of Linux and NTFS up any data on your NTFS partition, just FUSE is the Captive project by Jan Kratochvil. in case disaster strikes, and to check if FUSE, Filesystem in Userspace is a Released early in 2005, Captive uses the your computer fulfills the requirements. module for the Linux kernel that makes original ntfs.sys Captive supports Windows NT, Win- it possible to implement a fully func- driver, the NT kernel (ntoskrnl.exe), dows 200x, and Windows XP. (The proj- tional filesystem in a userspace pro- parts of ReactOs, and much program- ect homepage at [2] has a list of Win- gram. This gives non-privileged users ming by its author to ensure compatibil- dows XP versions supported by the latest the ability to access the filesystem.

30 ISSUE 74 JANUARY 2007 WWW.LINUX - MAGAZINE.COM Captive COVER STORY

Figure 1: Better be safe than sorry. Users are asked to confirm they Figure 2: The friendly captive-install-acquire GUI tool helps you set own a legal version of Windows. up Captive. upack by entering tar zxvf captive-static- based and self-explanatory. It does have mount command works, you now have 1.1.7-0.i368.tar.gz. After unpacking the a command line mode, just in case the read and write access to your NTFS par- RPM file or tarball, become root and run GUI crashes. (You can enter captive- tition. This simplicity is one of Captive’s the install script to install the binaries, install-acquire --text to run the text-based major strengths. automatically drop the captive-install- install.) Check out Figure 2 for an exam- acquire tool, and the captive-install-fstab ple of an install-acquire GUI screen. Captive Bench tool, into /usr/ sbin/, and create a captive After making sure that the drivers are in Often the office dual-boot system is an directory below /var/ lib. place below /var/ lib/ captive, the tool older PC that is kept around to run leg- goes on to set up mount points in /etc/ acy Windows software. We lined up a Finding the NTFS Drivers fstab. Your filesystem table file entry for similar system for our experiments with There are two basic approaches to find- Captive might look something like this: Captive. The test computer had a 2 GHz ing suitable NTFS drivers. You can either Pentium IV CPU, 256 MB RAM, and a copy the drivers directly to /var/ lib/ /dev/hda1 /mnt/captive-system U 60 GB Seagate UDMA100 hard disk. The captive, and if you have your crystal ball captive-ntfs defaults,noauto 0 0 RAM was definitely low-end by modern handy, or know from previous experi- standards, but as you’ll see, we experi- ence that the drivers you are copying If the acquire tool fails to set up appro- mented with adding more memory as will work, this is probably your best op- priate mount points for some reason, part of our test. Besides installing a legal tion. The alternative is to run captive- you can run the captive-install-fstab tool version of Windows XP, Service Pack 2, install-acquire and let the tool search for to retry. After set- Windows drivers. Note that the search ting up the mount will also include any network drives you points, there is have mounted, a process that can be nothing to stop fairly time-consuming. Even if you see you from mount- the acquire tool start scouring your net- ing the captive- work drives, you can always press Skip ntfs partition by to quit the scan phase and move on. entering, for If you do not have suitable drivers, or example, mount if you prefer not to wait until the acquire /mnt/ captive- tool has located them, acquire will open system/. Don’t for- up an Internet connection and grab the get to check the required drivers off the msdn. microsoft. final screen in the com website. Being a careful kind of per- GUI tool to dis- son, Jan Kratochvil asks you to confirm cover the correct that you are legally entitled to download mount point the files (see Figure 1). The download name, or read the size is fairly large (24 MB) so this ap- final line of output proach is only recommended if you have from acquire in Figure 3: captive-install-acquire in command line mode, with a handy a moderately fast Internet connection. text-only mode. list of required files for Windows XP Service Pack 2, and cut&paste The captive-install-acquire tool is GUI- Assuming the mount commands.

WWW.LINUX - MAGAZINE.COM ISSUE 74 JANUARY 2007 31 COVER STORY Captive

Figure 4: Fast directory table entry creation cour- Figure 5: The top utility can rule out lack of memory or CPU power as possible causes tesy of Captive. for the copy speed bottleneck. we tested Captive with various Linux tive is at creating directory table entries. a simple installation procedure should distributions: Suse 10.0, including the The file copy time was a fairly impres- not be underestimated; after all, nobody latest updates off the Web, Ubuntu sive two seconds (Figure 4); and again is more likely to dual-boot than a Win- Dapper Drake, and Fedora Core 6. our choice of distribution had no influ- dows user in the process of moving to The results were a mixed bunch of en- ence on the results. The table gives you Linux. couraging and disappointing measure- an overview. Captive is quite usable and perfectly ments that slightly dampened our origi- suited to every day tasks, such as sup- nal enthusiasm for Captive, and that Benchmarks Reloaded porting low-volume file copies of, say, remained puzzling to the end. Captive The CPU and memory usage statistics office documents that users might need performed well for low-volume copies from our original benchmarks, with CPU on both operating systems. What Cap- of individual files, such as a document load up to 97%, and memory consump- tive can’t do is provide a solution for saved by a single user using an office tion to match, suggested that adding users who object to proprietary licenses application. But for larger files, the tool memory might improve Captive’s perfor- or need to copy larger files. ran into some problems. Our attempts to mance. To test this theory, we doubled Users have to accept the fact that lack copy a file of 1002 MB from a Reiser par- our lab machine’s memory and reran the of insight into the internal workings of tition to captive-ntfs failed, with Captive benchmarks. CPU usage dropped slightly the proprietary NTFS filesystem makes issuing an invalid argument message with memory usage in single figures, as speed optimization difficult for volunteer after taking 45 minutes to copy 912 MB the top screenshot (Figure 5) goes to programmers. However, if speed and file of the file. This was followed by success- prove, and you might expect the copy size are not your major concerns, Cap- ful attempts to copy a 569 MB file – in 27 performance to benefit from this, but tive is an excellent choice for everyday minutes no matter what distribution we unfortunately, the copy took just as long use. ■ used – interspersed with slightly confus- as with 256 MB RAM. ing, if not annoying, connection refused To be double-sure, we upped the Having completed his training as a messages accompanied by copy failures. memory from 512 MB to 768 MB and re- technical assistant in information For our third benchmark, we copied 130 peated the benchmarks, but again this technology at college, Andreas Köller is now studying computer small files with a total size of 193 KB change had no effect on the copy suc- science and economics at B.A.O., a from a Reiser partition to our captive- cess rate or speed no matter what distro private university, in Leer, Germany. ntfs partition to discover how fast Cap- we chose. More memory definitely helps A sign on the back of his car reads by keeping the machine usable “Linux is sexy.” Table 1: Captive Benchmarks while copying is in progress, Besides being responsible for local- Copy from ReiserFS to NTFS via Captive but it seems that Captive is sim- ization at Linux New Media, Ian

Test 1 ply not designed for large files. THEAUTHORS Travis runs his own IT business, is a File cloop.img (1000.2 MB) freelance translator, and teaches Result Failed after 45 min. 920 MB of file copied Conclusions English and network management Error message Connection failed Users from all over the world for the local Chamber of Commerce. Test 2 have sung Jan Krachotvil’s File david.img (586.5 MB) praises for taking on the defi- INFO Result File copied error-free after 27 min – nitely non-trivial task of provid- [1] “Going over: Accessing Partitions on occasional connection failures ing write access to NTFS parti- Test 3 Dual-boot Systems,” Linux Magazine tions. Most of them have also Files 130 files of 1.5 kb each. #57, August 2005, p. 26 commented on the pain-free Result All files copied error-free in 2 sec. [2] Captive project homepage: http:// installation routine that helps All tests repeated 3 times. Same results on Suse 10.0, jankratochvil. net/ project/ captive/ Ubuntu Dapper Drake, Fedora Core 6. Linux newcomers get Captive [3] FUSE project homepage: All tests repeated with 512 MB, and 768 MB. Less CPU up and running in a matter of http:// fuse. sourceforge. net/ load – no speed or stability gains. minutes. And the importance of

32 ISSUE 74 JANUARY 2007 WWW.LINUX - MAGAZINE.COM