Ext2tools—Reading Linux files from DOS
I don't know about you, but I will admit to using Windows on my PC along with Linux. It's just that some Windows applications are still better than those available for the X windows system. (No flames, please. I didn't mention any names!)
Unfortunately, using both Windows and Linux on the same machine means I sometimes have important files on the MS-DOS partition, which I need while using Linux. I can access files on the MS-DOS partition with Linux, but often the opposite is true—I need to access Linux files from DOS or Windows 95. This used to involve getting out of Windows, booting Linux, moving a file to the DOS partition, and then rebooting Windows. Not a particularly convenient method!
NB: Be sure to have Loadlin working or a working Linux boot disk before you try loading Windows 95 if you use LILO to start Linux, as the installation of Windows will overwrite the Master Boot Record.
But it isn't that complicated any more, thanks to ext2tools, a collection of DOS programs written by Claus Tondering (email@example.com ). ext2tools allows me to read Linux (ext2) files directly from DOS or Windows. Five of ext2tools' DOS programs mimic Unix commands, and a sixth is used for set-up. The programs are E2CAT, E2CD, E2CP, E2LS, E2PART and E2PWD.
Using these commands is straightforward. From DOS, or a DOS window, you get a listing of the files in your Linux root directory with the command e2ls. If you want a listing of another directory, just add the directory name.
To change to another Linux directory, say, home, you enter e2cd home. Another e2ls then lists the files in home. If you find the file you need in the home directory, say it is called stuff.ext, typing e2cp stuff.ext stuff.dos will copy the file into stuff.dos in your present DOS directory. To just look at the file instead, e2cat stuff.ext will list it on your DOS screen.
The other DOS programs included in ext2tools are E2PWD, which gives the Linux directory you are currently in, and E2PRT, which is used to determine the partitions on a hard disk, which is to be signified by the disk number discussed below.
The set-up of ext2tools is really simple. It just requires you to add one line to your DOS autoexec.bat file to define the environmental variable e2cwd. The value of this variable is set to a two (or three) part number. I use:
The 128 indicates the first hard disk (129 would be the second.). The 2 denotes the partition number of the ext2 file system on that disk. A third number, which I omit, is the inode number of the current working directory. Leaving it blank results in the default value of 2, which identifies the root directory. After re-running autoexec.bat in a DOS window, typing that command on the command line, or simply rebooting DOS/Windows, you should be ready to use the tool program.
Claus Tondering, the author of the program and a Unix programmer/electrical engineer at Olicom in Denmark, says there are two limitations of ext2tools that he knows of. If there are three or more partitions inside an extended partition table, the table is read incorrectly. Secondly, if you have more than two hard disks, there is no way to get to the third, due to limitations on the use of BIOS for disk information. He hopes that the next version should take care of both these problems and may even support wild cards, but no promises.
The access to the Linux file system by ext2tools is read-only. To write Linux files you must be in Linux. In fact, Tondering does not plan to add write capabilities to these DOS programs as he fears that it could be dangerous for a variety of reasons.
Finally, a big warning. ext2tools gives superuser status to the DOS user, as it does not respect the access permissions of the Linux file system. This was by design, since having DOS on a Linux system is an inherent security risk anyway. Be careful if you install it on a multi-user system.
See Getting ext2tools sidebar for more information.
Robert A. Dalrymple (firstname.lastname@example.org) works at the University of Delaware and tends two machines that are half-and- half (Win95/Linux). He thanks Claus Tondering for helpful comments.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
|Secure Desktops with Qubes: Installation||May 28, 2016|
|CentOS 6.8 Released||May 27, 2016|
|Secure Desktops with Qubes: Introduction||May 27, 2016|
|Chris Birchall's Re-Engineering Legacy Software (Manning Publications)||May 26, 2016|
|ServersCheck's Thermal Imaging Camera Sensor||May 25, 2016|
|Petros Koutoupis' RapidDisk||May 24, 2016|
- Secure Desktops with Qubes: Introduction
- Secure Desktops with Qubes: Installation
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- CentOS 6.8 Released
- The Italian Army Switches to LibreOffice
- Linux Mint 18
- ServersCheck's Thermal Imaging Camera Sensor
- Chris Birchall's Re-Engineering Legacy Software (Manning Publications)
- Petros Koutoupis' RapidDisk
- Oracle vs. Google: Round 2
Until recently, IBM’s Power Platform was looked upon as being the system that hosted IBM’s flavor of UNIX and proprietary operating system called IBM i. These servers often are found in medium-size businesses running ERP, CRM and financials for on-premise customers. By enabling the Power platform to run the Linux OS, IBM now has positioned Power to be the platform of choice for those already running Linux that are facing scalability issues, especially customers looking at analytics, big data or cloud computing.
￼Running Linux on IBM’s Power hardware offers some obvious benefits, including improved processing speed and memory bandwidth, inherent security, and simpler deployment and management. But if you look beyond the impressive architecture, you’ll also find an open ecosystem that has given rise to a strong, innovative community, as well as an inventory of system and network management applications that really help leverage the benefits offered by running Linux on Power.Get the Guide