[Techtalk] Finding windows files while using linux
Rasjid Wilcox
rasjidw at openminddev.net
Wed Mar 19 22:32:44 EST 2003
On Wed, 19 Mar 2003 07:32 pm, Dan Richter wrote:
> Hi.
>
> Thanks to the world-wide nature of the Internet, I woke up about the time
> you went to sleep - if college students sleep... :-)
>
> You can access Windows files by "mounting" your Windows partition on the
> Linux filesystem. I believe that Red Hat 8 can read the filesystem used by
> Win2k: someone correct me if I'm wrong there.
>
> To mount the Windows partition onto the Linux filesystem (which you can
> only do as root), you must first have a destination directory (any empty
> directory will do):
> $ mkdir /mnt/win2k
> Now mount the filesystem using the device corresponding to your windows
> partition. Example:
> $ mount /dev/hda1 /mnt/win2k
> The /dev/hda1 is only an example. "hda" means your first hard drive (the
> second is "hdb"), and "1" means the first physical partition. I found the
> correct disk by trial and error: I listed everything corresponding to
> /dev/hd* and then I mounted until I got what I wanted. Most of the time
> mount just failed, because the partition didn't exist. I also managed to
> mount the Linux filesystem onto the filesystem, which wasn't damaging at
> all and was actually kind of amusing.
# fdisk /dev/hda -l
Disk /dev/hda: 41.1 GB, 41174138880 bytes
255 heads, 63 sectors/track, 5005 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 255 2048256 b Win95 FAT32
/dev/hda2 256 892 5116702+ 83 Linux
/dev/hda3 893 1147 2048287+ 83 Linux
/dev/hda4 1148 5005 30989385 f Win95 Ext'd (LBA)
/dev/hda5 1148 1402 2048256 83 Linux
/dev/hda6 1403 1529 1020096 82 Linux swap
/dev/hda7 1530 1656 1020096 83 Linux
/dev/hda8 1657 5005 26900811 83 Linux
This will list all the partitions on the master hard-drive attached to the
first IDE controler. Similarly
# fdisk /dev/hdb -l
will list all the partitions on the slave hard-drive on the first IDE
controler. /dev/hdc and /dev/hdd are the master and slave respectively on
the second IDE controler. Most desktop PC's only have 2 IDE controlers, but
it just keeps going up in pairs.
In the above listing, /dev/hda1 is my windows 98 system, which is FAT32.
However, if it was windows 2000 with an NTFS filesystem, it would say
HPFS/NTFS.
Don't be fooled by the "Win95 Ext'd (LBA)" partition. That is not a real
partition. It is the last 'primary' partition (DOS could only cope with 4 of
them) within which all the other 'extended' partitions fit inside. See the
cylinder numbers.
So it is clear from the above that my windows partition is /dev/hda1. It will
be hopefully equally clear which is your NTFS partition.
Another word of warning - some new machines (some HP mahcines come to mind,
and many laptops) don't come with installation disks. They have a 'hidden'
windows partition that holds all the 'installations disks' on the hard-drive.
If this is the case, it will show up as an additional partition, and I think
they are generally FAT32.
> Once the filesystem is mounted, anyone can read from it but only root can
> write to it. Don't try to write to it until you're sure that mount has
> correctly guessed the filesystem type. Maybe someone else can tell us how
> to explicitly tell mount what filesystem you want.
# mount -t ntfs /dev/hda1 /mnt/win2k (for ntfs)
# mount -t vfat /dev/hda1 /mnt/win98 (for fat32)
> By the way, to unmount a filesystem, use umount (notice that it's "umount"
> and not "unmount": the extra "n" would be too much to type). Alternatively,
> the filesystem will be unmounted automatically when you shut down Linux.
>
> >I have a dual boot machine (Win2000 & RH8). My lecturer wants us to
> >use the "tr" command on a windows file. I'd like to know if there's a
> >way to access windows files thru the command line while I'm using
> >linux, rather than rebooting into Windows. If anyone can help, that
> >would be great!
Another option would be to install Cygwin under Windows 2000. You then get
access to all the standard Linux/Unix command line tools (tr, diff etc etc)
on windows (and without having to reboot). See http://www.cygwin.com
Cheers,
Rasjid.
More information about the Techtalk
mailing list