How can I copy files from windows' partition to linux' partition ?

First, don't worry if this article is a a little long.. It's a very important thing in Linux, and you'll probably use it a lot.. OK so let's start:
If you want to copy files from your windows'/dos partition to linux' partition, you first have to mount your windows partition (Under linux, because windows doesn't support linux' partitions). Instructions (If you are under X, open a terminal window) :
  • Make a directory that under it the partition's files will be, using "mkdir dirname". (for example mkdir /c).

  • You need to know windows' partition's address in Linux:
    • First you need to know the harddrive's address. It's /dev/hdx , while x is the number of the harddrive (Check in the bios if it's 1st,2nd,3rd or 4th). If it's your 1st HD the address is /dev/hda , if it's your 2nd HD the address is /dev/hdb, etc..

    • Then you have to know the partition's number (You can check it under PartitionMagic or a similar program). If it's partition #1 under the 2nd HD, the address is /dev/hdb1, Partition #3 under the 1st HD: /dev/hda3 , etc..
    • Usually the partition's number is #1, because in our days windows is the first OS people usually install.

  • Now just mount the drive using "mount /dev/hdxy /dirname" (For example: mount /dev/hda1 /c).
  • In some cases & in older linuxes, You need to specify the kind of the partition. The same examlpe with telling linux that the partition is of dos/windows (vfat): "mount -tvfat /dev/hda1 /c".

Now you can do (Almost) whatever you want in the windows/dos partition, But when you'll reboot your system Linux will "forget" that you mounted the partition.. So to make linux automount the partition on every reboot, you have to edit the /etc/fstab file:
  • This is a system file so you can change it only under root access: Type in a terminal window/console "su" and then your root password to get root access.

  • Edit the file /etc/fstab using "vi /etc/fstab" (Ofcourse you can use another editor then vi).
  • If you use the vi editor, press insert to insert text

  • Add at the bottom of the file the next text (change it to your needs), but remember: Use the TAB key instead of spaces!

  • /dev/hda3 /c vfat defaults 0 0

  • Close & Save by hitting the ':' key, and typing 'exit!' . That's it :).
Some remarks:
  • You can use this article to mount CD ROMs, Linux' filesystems, etc.. You just have to replace the "vfat" with the filesystem's name:
    • Linux: ext2

    • CD ROM: iso9660

  • Old kernels will not support FAT32. But only real old kernels.

  • There's no different between mounting a windows filesystem to dos filesystem


This document was written by Mar_Garina, 06 Oct 1999.