NT Version 1.06 - August 12, 1997
The ext2 tools are a set of programs that enable you to read a Linux ext2 file system under Windows NT.
The ext2 tools consist of the following programs:
Analogous to the Linux cat command |
|
Analogous to the Linux cd command |
|
Analogous to the Linux cp command |
|
Analogous to the Linux ls command |
|
Lists hard disk partitions |
|
Analogous to the Linux pwd command |
|
Provides means to run these program without Administrator privileges |
These programs make use of a subset of the Linux e2fstools library. Claus Tondering wrote the original version for use in DOS, and I have ported them to run under Windows NT.
There are currently no programs for writing to an ext2 file system. These may be not to hard to implement, and if any body wants to try, then feel free!
The programs are distributed in both binary and source code form. To compile them a combination of Microsoft VC++, and cygwin's GCC, and other utilities.
Before you use the ext2 tools, you must set the environment variable E2CWD using a statement similar to the following:
SET E2CWD=1:2 or SET E2CWD=1:2:234
The three numbers after the equals sign are interpreted thus:
The first number (1 in the above example) identifies the physical disk on which the ext2 file system is located. This number is used in the opening of the partition or physical drive (i.e. \\.\PhysicalDrive2, or \Device\Harddisk1\Partition2 )
Typical values are:
0 for first hard disk 1 for second hard disk
The second number (2 in the above example) is the number of the disk partition on which the ext2 file system is located. This number is typically part of the Linux file name for the disk device, but not necessarily so. If, for example, you are used to referring to the disk as /dev/hdc2 under Linux, the partition number is 2. The E2PART program can help you identify the partitions.
The third number is the inode number of the directory that is to be your current working directory. The inode in a UNIX file system is a number that uniquely identifies a file or directory in a file system. If this number is omitted, 2 (the root inode number) is used. You don't need to worry understanding the significance of what an inode is. Just omit the final number from E2CWD.
Note: File names starting with / will be interpreted relative to the root directory on the particular disk identified by the E2CWD environment variable.
None of the programs support wildcards.
Due to the fact that these programs read from devices, NT requires that you have administrator privileges to run these programs. Alex Frink has provided a neat method of working around this, and I have included with this distribution. It is an NT service (ext2serv.exe) that can be used to allow selective access to a device. From Alex's Note to me here is a description of how to use it:
I have attached a service that should do what you need. It is still beta and not very much tested however (and not documented as well). - Compile it with gcc or VC++. - Create a registry key at HKEY_LOCAL_MACHINE\Software\Utilities\Ext2Tools\Users and add values of the like PHYSICALDRIVE0, type REG_SZ (no \\.\) with a comma-separated list of users and/or groups who should use the Ext2Tools (not necessary to include Administrators and System). - Install the service with 'ext2serv -install' (as Administrator) - Start it with Control Panel/Services. It will now apply the ACL specified in the registry, and then wait for changes of this key (should not use many system resources) to reapply the ACL. If you don't want to run it as a service, use 'ext2serv -now' to apply the ACL once. Or set the Startup Type to Automatic and a value AutoTerminate, type REG_DWORD, 1 under HKEY_LOCAL_MACHINE\Software\Utilities\Ext2Tools\Parameters Then it should apply the ACL at boot time, then terminate completely. Further I added a small program that copies the ACL from one file to another. You can use it to check if the ACL on \\.\PHYSICALDRIVE0 is o.k. by copying it to an existing e.g. c:\temp\test.txt and view it with Explorer/Permissions. Usage should be clear. Best regards, Alex
I have recently changed the internals of the tools a bit so that access to PhysicalDriveXXXX is only needed for the e2part program. To allow users to use the e2part program add PhysicalDriveXXX keys as described above. The registry entries that are needed to allow access to the partitions are of the form
dev_hdXY
Where X is the letter corresponding to the physical drive number ( 0 == a, 1 == b, ... ), and Y is the partition number.
So if I want to allow the Guest and Test users to use the ext2tools on my system I have to create registry entries
dev_hdb1 "Guest,Test" dev_hdb2 "Guest,Test"
and if I want to allow them to use e2part on that same disk I add the entries:
PHYSICALDRIVE1 "Guest,Test"
I hope that these tools can be of use.
The e2part program has some known problems. It seems that the DeviceIoControl used to obtain partition information doesn't work consistently on all systems, and may have a problem if the disk contains extended partitions. It is possible that invoking 'e2part <diskno>' will not return information about all your partitions in this case, but 'e2part <diskno> <partno>' may still work. This doesn't affect the functionality of any of the main ext2 programs as none of these other programs need any specify partition information anymore and do not invoke the DeviceIoControl API.
E2part is only to help identify where your ext2 partitions lie, so if either method doesn't work for you, and you don't know where your ext2 partitions lie, then you just need to identify your ext2 partitions in another fashion. If you need to you can experiment with different settings of E2CWD. Ext2 partitions have a 'magic' number in a specific part of file system header (the superblock). If you set E2CWD wrong and this magic number is not found then all that will happen is that the e2XXX program will terminate with an error. The chances of a non ext2 file system being identified as an ext2 file system are small (1/65536), and these programs are read only anyhow, so it wouldn't be serious if it did happen.
You probably know already what partition number you need to use, and if you know that you have a linux partition on /dev/hdb1 then you probably just have to set E2CWD=1:1 and you are done, but this is not necessarily the case. If your Linux partitions are named /dev/hdb1, /dev/hdb2, … and so forth, that does not mean that /dev/hdb2 is necessarily placed physically after /dev/hdb1 - I have seen weird stuff happen to my Linux partition naming after deleting and creating new partitions with the NT Disk Admistrator after having previously used Linux fdisk. None of this is bad, it just means that the /dev/hdb2 partition number as far as E2CWD is concerned may not be 2.
E2part has another bug. If you specify the partition number explicitly, and if that partition contains a file system currently in use by NT, then an error will be returned, and no partition information will be availabl|e.
Apparently the ext2serv route for non-administrators is rather "delicate" with utilities GPF'ing if the registry syntax is slightly wrong (eg using dev_hdb2 "david coe" instead of "david,coe". A correct entry works fine initially but after a few hours/days the utilities again GPF and the registry needs to be reset to get things going again. I haven't looked into either of these yet, as I don't use a user id that doesn't have root privleges, and have therefore little need for this service myself.
There are a lot of neat things that could be done, but whether or not they do get done is an open question at this point.
I may be contacted at peeter@accessv.com or peeter_joot@vnet.ibm.com. My web page is at http://www.accessv.com/~peeter. Claus Tondering, the author of the original DOS version of these tools can be contacted by e-mail at c-t@pip.dknet.dk. However, I do not believe that he is working on these tools any more as the BIOS level calls used in the DOS version aren't compatible with his current harddrive.
The ext2 tools are copyright © 1995 Claus Tondering (c-t@pip.dknet.dk ). The Windows NT portions are copyright © 1997 Peeter Joot (peeter@accessv.com, peeter_joot@vnet.ibm.com).
Note: The ext2fs routines are copyright © 1993, 1994, 1995 Theodore Ts'o. For further copyrights, see the source code files.
The ext2 tools may be redistributed under the terms of the GNU General Public License, which is included in the file called COPYING.
This is free software. Use it at your own risk. Support is informal, but I will do my best to see that bugs are fixed. You can feel free to contact me if new features are desired, or you can just send me bug fixes and new code and I will see about integrating them into the main distribution.