Sharing files between windows/linux

I have WindowsXP and RedHat Linux 9 installed on the same machine, with two 80GB HD drives. There are several Windows partitions on the two hard disks (FAT32 and NTFS), and I would like to access them from Linux (only FAT32 is possible I suppose). How can this be done?
Who is Participating?
LuxanaConnect With a Mentor Commented:

are you sure that /dev/hdb1 is the correct partition what youwant to mount? As I can see you do not have fdisk so please try # cfdisk and print out the partitions tables from both /dev/hda and /dev/hdb and paste it here for us please just to make thinks clear.

as root:

# cfdisk /hdb  

then choose print table the aoutput schould look like this :

Partition Table for /dev/hda

         ---Starting---      ----Ending----    Start     Number of
 # Flags Head Sect Cyl   ID  Head Sect Cyl     Sector    Sectors
-- ----- ---- ---- ---- ---- ---- ---- ---- ----------- -----------
 1  0x00    1    1    0 0x12  254   63  254          63     4096512
 2  0x00    0    1  255 0x07  254   63 1023     4096575    20482875
 3  0x80  254   63 1023 0x83  254   63 1023    24579450     6843690
 4  0x00  254   63 1023 0x05  254   63 1023    31423140    46717020
 5  0x00  254   63 1023 0x0B  254   63 1023          63    44917677
 6  0x00  254   63 1023 0x82  254   63 1023          63      497952
 7  0x00  254   63 1023 0x0B  254   63 1023          63     1301202

or you just check partions and filesystems what you have  and make sure that /dev/hdb1 is not extended partition.

JoelCantConnect With a Mentor Commented:
mount -t vfat /dev/hdX /mnt/X

where /dev/hdx is the drive you want to mount, hda1 is the first partition on the primary ide channel master drive, hdb1 is the first partition on the primary ide channel slave drive, and so on. You can mount ntfs drives (mount -t ntfs), but only read from them with 2.4.x kernels, and partially write with 2.6.x kernels. /mnt/X is where you want to mount it (doesnthave to be in /mnt, but for tidyness sake thats where most people put it), rember you need to make the directoryyou want to maount the drive to eg;

mkdir /mnt/windows
mount -t vfat /dev/hda1 /mnt/windows

Hope this helps


knollbertConnect With a Mentor Commented:
check out

It'll change your fstab file
create folders to place it mounted partitions in
And can Read/write safely  
Only requirements are having an internet connection so it can grab
Xp SP1 to get windows dll's
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

And can Read/write NTFS safely  
thanasis57Author Commented:
Thank you Joel

A) I name one partition "data" . It is the first partition on the second HD (as they appear in Partition Magic). I created the directory /mnt/data and gave the command:

mount -t vfat /dev/hdb1 /mnt/data

The response was:
mount: wrong fs type, bad option, bad superblock on /dev/hdb1,
       or too many mounted file systems
       (aren't you trying to mount an extended partition,
       instead of some logical partition inside?)

B)The second partition on this HD is named " software". After creating /mnt/software, and giving the command:
mount -t vfat /dev/hdb2 /mnt/software

the response was
mount: /dev/hdb2 already mounted or /mnt/software busy
mount: according to mtab, /dev/hdb2 is mounted on /home

However,  there is no such directory in /home

--To knollbert
The problem is that I should reformat my drives, which are already FAT32, and I would like to avoid that.

Thanks in advance
gn0Connect With a Mentor Commented:
it seems that you are mounting the wrong partitions - post to output of the following commands and we would be better able to help you .....

fdisk -l

(NB last letter of the first command is common "L")
the first command will list all partitions on all you drives.... the second will give the mounted partitions.....
also tell us the size of your 'data' and 'software' directory....

thanasis57Author Commented:
Thanks gn0:

fdisk -l or -L:
bash: fdisk: command not found

/dev/hda3 on / type ext3 (rw)
none on /proc type proc (rw)
usbdevfs on /proc/bus/usb type usbdevfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hdb2 on /home type ext3 (rw)
none on /dev/shm type tmpfs (rw)
/dev/hdb3 on /windows type vfat (rw,noexec,nosuid,nodev)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

It seems that I have not understood how partitions are named according to Linux standard, so I just give them in order of appearence in Partition Magic:

1) C: 14000MB, NTFS
2) F: 20000MB, NTFS
3) G: 20000MB, NTFS
4) Linux partition Ext2 13000MB
5) swap

1) H: (data) 20000MB, FAT32
2) I: (software) 20000MB, FAT32
3) Linux partition Ext2 10000MB
4) J: (mp3) 10000MB, FAT32. This partition only is accessible as /windows

Do you also need to know which partitions  are logical or primary?

thanasis57Author Commented:
Here is a complete list:

1) C: 14000MB, NTFS, primary

2) F: 20000MB, NTFS, logical |----->
3) G: 16000MB, NTFS. logical |----->In the same axtended partition

4) Linux partition Ext2 13000MB, primary
5) swap, primary

1) H: (data) 20000MB, FAT32, logical      |------>
2) I: (software) 20000MB, FAT32, logical |------>In the same extended partition

3) Linux partition Ext2 10000MB, primary
4) J: (mp3) 10000MB, FAT32, primary. This partition only is accessible from Linux as /windows

# cfdisk /dev/hdb  not #cfdisk /hdb :-)

if the /dev/hdb1 is extended partition then justa heve a look for the correct partition what you need to mount and also use appropriate filesystem option iny mount command.

thanasis57Author Commented:
Thank you luxana,

I tried what you told me, but the command:
# cfdisk /dev/hdb
gave no result.

I also tried appending the output:
# cfdisk /dev/hdb > hdb.txt
but no txt file was created.

When I tried:
cfdisk /dev/hdb
the command was not found.
thanasis57Author Commented:
I believe that the correspondence of partitions between window/linux must be the following:

Part. no     windows letter      linux    filesystem     mount point

1)                       C:              hda1      ntfs
2),3)               F:, G:             hda2      ntfs
                (two logical partitions
                in the same extended
4)                       -                hda3      linux ext2         /
5)                       -                hda4      swap

1),2)                    H:,I:          hdb1       FAT32
                (two logical partitions
                in the same extended
3)                         -              hdb2      linux ext2         /home
4)                         J:             hdb3      FAT32             /windows

Sorry for the presentation, but I am still novice at Linux

Is there any chance that you can show as you real partition table like linux output from # fdsik or from # cfdisk?

Because as I know that in linux logical partitions starts with number 5 your first logical partition must starts hdb5 ( if it is logical !) . Your extendet partition can starts hdb1. Here is example:

/dev/hdb1 (primary)
/dev/hdb2 (extended)->think of it as primary but you can't  mount it it is just a container for logical p.
/dev/hdb5 (logical)
/dev/hdb6 (logical)

So is it not the /dev/hdb5 first logical partition what we are loking for?

# cfdisk  ( with no options this should give you default /dev/hda primary master)
# cfdisk /dev/hdb ( this is for secondary master )

I'm using debian but in redhat cfdisk should be same check man pages for cfdisk just ina case.

let us know how you doing...

thanasis57Author Commented:

# cfdisk doesn't work in RedHat, and there is no such man entry. Maybe you know the corresponding command?

Also, you need to know that I created my partitions for windows first, and that the first partitions in the disk are logical. Maybe that might cause a problem?
what you get from this:

# which cfdisk  

;for manul page for cfdisk
# man cfdisk

did you try mount /dev/hdb5 ?

try mount /dev/hdb5

# mount /dev/hdb5 -t vfat /mnt/your_folder  
also look at my partitions table for example:

Partition Table for /dev/hda

         ---Starting---      ----Ending----    Start     Number of
 # Flags Head Sect Cyl   ID  Head Sect Cyl     Sector    Sectors
-- ----- ---- ---- ---- ---- ---- ---- ---- ----------- -----------
 1  0x00    1    1    0 0x12  254   63  254          63     4096512 -  compaq diagnostic (primary)
 2  0x00    0    1  255 0x07  254   63 1023     4096575    20482875 - NTFS (primary)
 3  0x80  254   63 1023 0x83  254   63 1023    24579450     6843690 - linux native (primary)
 4  0x00  254   63 1023 0x05  254   63 1023    31423140    46717020 - extended
here starts logical partitions:
 5  0x00  254   63 1023 0x0B  254   63 1023          63    44917677 - W95 FAT32 (logical)
 6  0x00  254   63 1023 0x82  254   63 1023          63      497952 - linux swap (logical)
 7  0x00  254   63 1023 0x0B  254   63 1023          63     1301202 - W95 FAT32 (logical)
thanasis57Author Commented:
A friend came over and halped me out.

whereis fdisk
we found that it is in /sbin/fdisk

/sbin/fdisk /dev/hda, or hdb
we obtained the partition tables and saw which ones we should mount

mount /dev/hdbx /mnt/filename
we mounted the desired partition to the desire mountpoint

-Finally we modified /etc/fstab so that the partitions are mounted at startup, by adding the lines:
/dev/hdbx         /mnt/filename               vfat            defaults,user   0  0

Thanks for the effort everyone. I will split the points to JoelCant, knollbert, gn0 and mainly to Luxana.
thanasis57 ,

I'm just curious but what partition number was it we were looking for? /dev/hdb?    

good luck
thanasis57Author Commented:
It was pertitions hdb3, hdb5 and hdb6 that I wanted to mount
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.