LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Copy files from windows to linux partition (https://www.linuxquestions.org/questions/linux-newbie-8/copy-files-from-windows-to-linux-partition-589793/)

nataly 10-05-2007 08:10 PM

Copy files from windows to linux partition
 
I installed Linux and Windows in the same computer and i would like to access files on the Windows partition. I know that i must use the mount command.

My question is what command should i write after i mount the windows partition, to copy the windows files on linux, not just see them. Is it possible to do that?

P.S. I can read and copy linux partitions from windows using "Linux Reader", but i want to do the exact opposite!!!

mjmwired 10-05-2007 08:47 PM

Which version of Linux?

Run 'man mount' for more information.

If Windows is using NTFS (XP, 2000, Vista?), google for 'ntfs-3g' support in your Linux distribution.
If Windows is using FAT32 (98, Me, older), that is automatically supported run 'man mount' and look for 'vfat'.

jiml8 10-06-2007 09:42 AM

After you have mounted the drive?

From the command line, the cp command will copy from windows to linux. You also can click/drag from a graphical desktop such as KDE or Gnome.

nataly 10-06-2007 10:42 AM

Quote:

Originally Posted by jiml8 (Post 2915279)
After you have mounted the drive?

From the command line, the cp command will copy from windows to linux. You also can click/drag from a graphical desktop such as KDE or Gnome.

Can you please write the full cp command that i must use? I am new at linux and i am now trying to learn some things so i have a problem with that:)

sunils1973 10-06-2007 11:24 AM

as the root user type
# fdisk -l
It will show all partitions of your disk.(hda1,hda2...)

You can easily identify the partition in which windows has installed (ntfs/vfat), may be hda1
# mkdir /mnt/windows (if there is no such directory)

# mount /dev/hda1 /mnt/windows
or
# mount -t ntfs /mnt/windows
this will mount your windows file system

# ls /mnt/windows

# cp /mnt/windows/ /home/username/

jiml8 10-09-2007 10:37 AM

Quote:

Originally Posted by nataly (Post 2915306)
Can you please write the full cp command that i must use? I am new at linux and i am now trying to learn some things so i have a problem with that:)

To learn how to use any of the commands that are commonly available from the command line, use the man command.

Thus, man cp will give extensive directions on the usage of the cp command.

Generally, you'll do something like this:

cp filename /path/to/destination/filename

in order to copy. But there are lots of options and wildcards are supported. So studying man is the best thing to do.

devn 10-09-2007 11:08 AM

Quote:

Which version of Linux?

Run 'man mount' for more information.

If Windows is using NTFS (XP, 2000, Vista?), google for 'ntfs-3g' support in your Linux distribution.
If Windows is using FAT32 (98, Me, older), that is automatically supported run 'man mount' and look for 'vfat'.
I guess you should look for what type of file system you are looking to mount.
If its NTFS, look for ntfs kernel drivers for your linux. If your partition is FAT32, your kernel should already support it natively.

If you are using Fedora or redhat flavour, you could try out this script:

Code:

#!/bin/bash
#
# Copyright 2003-2004 FlatCap (Richard Russon)
# This file may be copied under the terms of the GNU Public License:
#  http://www.gnu.org/licenses/gpl.html
#
# Determine which NTFS RPM the user needs.
#
# This file is available online from:
#  http://data.linux-ntfs.org/rpm/whichrpm
#
# whichrpm should be used in conjuection with the NTFS RPM instructions:
#  http://www.linux-ntfs.org/content/view/127/63/
#
# ChangeLog:
#
# 1.11 - 15 Apr 2007 - Richard Russon (FlatCap)
#    - Identify RHEL5 and CentOS5
#
# 1.10 - 20 Mar 2006 - Richard Russon (FlatCap)
#      - Identify Fedora 5 (Bordeaux)
#
# 1.9 - 8 Mar 2006 - Richard Russon (FlatCap)
#    - Identify CentOS 4 (RHEL4 clone)
#
# 1.8 - 3 Dec 2005 - Richard Russon (FlatCap)
#    - Update links to point at the new website
#
# 1.7 - 6 Jul 2005 - Richard Russon (FlatCap)
#    - Identify Fedora Core 4 Xen kernels
#    - Contrib has moved to main pages
#
# 1.6 - 13 Jun 2005 - Richard Russon (FlatCap)
#    - Identify RedHat Enterprise 4 (Nahant)
#    - Identify Fedora Core 4 (Stentz)
#
# 1.5 - 24 Nov 2004 - Richard Russon (FlatCap)
#    - Direct 64-bit users to the contrib page
#
# 1.4 - 18 Oct 2004 - Richard Russon (FlatCap)
#    - Identify RedHat Enterprise 4 Beta
#
# 1.3 - 02 Aug 2004 - Richard Russon (FlatCap)
#    - Identify RedHat Enterprise
#
# 1.2 - 02 Aug 2004 - Richard Russon (FlatCap)
#    - Identify Fedora Core 2 and Fedora Core 3 test versions
#    - Bugfix: More verbose on errors
#
# 1.1 - 03 Dec 2003 - Richard Russon (FlatCap)
#    - Bugfix: multiple kernels gave misleading results
#
# 1.0 - 09 Nov 2003 - Richard Russon (FlatCap)
#    - Initial version
#    - Identifies RH7,8,9 and FC1

# Intialisation

VER="1.11"
RDT="15 April 2007"
REL=
DOWN=

if [ "$1" = "-v" ]; then
        VERBOSE="true"
fi

vecho()
{
        if [ "$VERBOSE" = "true" ]; then
                echo $*
        fi
}


# Welcome

vecho
vecho "This is the 'whichrpm' script, v$VER, released $RDT"
vecho "It will try to work out which NTFS RPM you need."
vecho
vecho "The latest version can be downloaded from:"
vecho "    http://www.linux-ntfs.org/content/view/127/63/"
vecho

# First determine which vendor we have: RedHat or Fedora

RH_REL=/etc/redhat-release
FC_REL=/etc/fedora-release

if [ -f $FC_REL ]; then
        VENDOR="Fedora"
        REL=`cat $FC_REL`
else
        if [ -f $RH_REL ]; then
                VENDOR="RedHat"
                REL=`cat $RH_REL`
        fi
fi

if [ -z "$REL" ]; then
        echo "Error:"
        echo "Unfortunately, I can't find either /etc/redhat-release, or"
        echo "/etc/fedora-release  Without either of these files, I can't work out"
        echo "which distribution you have."
        echo "Giving up."
        echo
        exit 1
fi

# See if we have a download for this version

case $REL in
        "Fedora Core release 5 (Bordeaux)")
                vecho "You are using Fedora 5 (Bordeaux)"
                DOWN="http://www.linux-ntfs.org/content/view/187/89/"
                ;;
        "Fedora Core release 4 (Stentz)")
                vecho "You are using Fedora 4 (Stentz)"
                DOWN="http://www.linux-ntfs.org/content/view/129/65/"
                ;;
        "Fedora Core release 3 (Heidelberg)")
                vecho "You are using Fedora 3 (Heidelberg)"
                DOWN="http://www.linux-ntfs.org/content/view/130/66/"
                ;;
        "Fedora Core release 2 (Tettnang)")
                vecho "You are using Fedora 2 (Tettnang)"
                DOWN="http://www.linux-ntfs.org/content/view/133/69/"
                ;;
        "Fedora Core release 1 (Yarrow)")
                vecho "You are using Fedora 1 (Yarrow)"
                DOWN="http://www.linux-ntfs.org/content/view/134/70/"
                ;;
        "Fedora Core release"*)
                echo "I don't recognise this version of Fedora Linux.  Please check you have the"
                echo "latest version of the 'whichrpm' script."
                ;;
        "Red Hat Linux release 7.0 (Guinness)" |        \
        "Red Hat Linux release 7.1 (Seawolf)"  |        \
        "Red Hat Linux release 7.2 (Enigma)")
                echo "Unfortunately, you are running an old version of RedHat Linux."
                echo "There aren't any NTFS RPMs for this version.  I recommend that you consult"
                echo "the RedHat website for instruction on how to upgrade your kernel."
                ;;
        "Red Hat Linux release 7.3 (Valhalla)")
                vecho "You are using RedHat 7.3 (Valhalla)"
                DOWN="http://www.linux-ntfs.org/content/view/139/75/"
                ;;
        "Red Hat Linux release 8.0 (Psyche)")
                vecho "You are using RedHat 8.0 (Psyche)"
                DOWN="http://www.linux-ntfs.org/content/view/138/74/"
                ;;
        "Red Hat Linux release 9 (Shrike)")
                vecho "You are using RedHat 9 (Shrike)"
                DOWN="http://www.linux-ntfs.org/content/view/137/73/"
                ;;
        "Red Hat Enterprise Linux "??" release 3 (Taroon"*)
                vecho "You are using RedHat Enterprise 3 (Taroon)"
                DOWN="http://www.linux-ntfs.org/content/view/136/72/"
                ;;
        "Red Hat Enterprise Linux "??" release 4 (Nahant"*)
                vecho "You are using RedHat Enterprise 4 (Nahant)"
                DOWN="http://www.linux-ntfs.org/content/view/135/71/"
                ;;
        "Red Hat Enterprise Linux "*"Tikanga"*)
                vecho "You are using RedHat Enterprise 5 (Tikanga)"
                DOWN="http://www.linux-ntfs.org/content/view/257/92/"
                ;;
        "CentOS release 4"*)
                vecho "You are using CentOS release 4"
                DOWN="http://www.linux-ntfs.org/content/view/135/71/"
                ;;
        "CentOS release 5"*)
                vecho "You are using CentOS release 5"
                DOWN="http://www.linux-ntfs.org/content/view/257/92/"
                ;;
        "Red Hat Enterprise Linux"* |        \
        "Red Hat Linux"*)
                echo "Unfortunately there aren't any NTFS RPMs for the version of RedHat Linux"
                echo "that you are running."
                ;;
        *)
                echo "I can't identify which distribution you are running."
                ;;
esac

if [ -z "$DOWN" ]; then
        echo "Giving up."
        echo
        exit 1
fi

# determine which kernel version and type we have

KVER=`uname -r`

case $KVER in
        *smp)
                vecho "You have an Multi Processor (SMP) kernel"
                SECTION="Multi Processor"
                SUFFIX='-smp'
                VERSION=`echo $KVER | sed 's/smp$//'`
                ;;
        *BOOT)
                vecho "You have a Specialist kernel"
                SECTION="Specialist"
                SUFFIX="-BOOT"
                VERSION=`echo $KVER | sed 's/BOOT$//'`
                ;;
        *xen0)
                vecho "You have a Specialist kernel"
                SECTION="Specialist"
                SUFFIX="-xen0"
                VERSION=`echo $KVER | sed 's/xen0$//'`
                ;;
        *xenU)
                vecho "You have a Specialist kernel"
                SECTION="Specialist"
                SUFFIX="-xenU"
                VERSION=`echo $KVER | sed 's/xenU$//'`
                ;;
        *bigmem)
                vecho "You have a Specialist kernel"
                SECTION="Specialist"
                SUFFIX="-bigmem"
                VERSION=`echo $KVER | sed 's/bigmem$//'`
                ;;
        *hugemem)
                vecho "You have a Specialist kernel"
                SECTION="Specialist"
                SUFFIX="-hugemem"
                VERSION=`echo $KVER | sed 's/hugemem$//'`
                ;;
        *)
                vecho "You have a Single Processor kernel"
                SECTION="Single Processor"
                SUFFIX=""
                VERSION=$KVER
                ;;
esac

# determine which architecture the kernel is

ARCH=`rpm -q --queryformat '%{ARCH}' kernel$SUFFIX-$VERSION`

vecho "You have an $ARCH kernel"
vecho

# Summarise

vecho "Go to this page:"
vecho "  $DOWN"
vecho
vecho "and lookup Version '$VERSION' in the 'NTFS RPMs' table."
vecho "Then find the '$ARCH$SUFFIX' column - it will be in the '$SECTION' section."

vecho
vecho "Summary..."
echo
echo "Web Page: $DOWN"
echo "Version:  $VERSION"
echo "Section:  $SECTION"
echo "Arch:    $ARCH$SUFFIX"
echo

Or visit http://www.linux-ntfs.org (http://www.linux-ntfs.org/doku.php?id=downloads (the download page))
to download the correct rpm for your kernel and arch.

I guess it should resolve your problem.

then mount your partition using this command (if your partition is /dev/hda1):

Code:

mkdir /mnt/win
mount /dev/hda1 /mnt/win

++++++++++++++++++++++++++++++++++++++++++++++

Then
Code:

cd /mnt/win
cp <your file names go here> <your destination directory name here>

++++++++++++++++++++++++++++++++++++++++++++++


All times are GMT -5. The time now is 10:09 PM.