LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-21-2007, 01:19 AM   #1
jasee
LQ Newbie
 
Registered: Jun 2006
Posts: 27

Rep: Reputation: 15
Connecting ān external harddisk via usb to Redhat Linux


Sorry if this has been asked before, but I couldn't find it.
I am a Linux newbie.
I'm logged in as root to an installation of Red Hat Enterprise ES (2.4.21-4 EL). I didn't install it. There don't seem to be that many useful tools around and I'm not familiar with working at the terminal? prompt.
I've connected an external hard disk by a usb port. It's got an ntfs primary partition. I want to copy some files into a partition. I can open the directory I want to copty the files into, I know drag and drop works!
I can't find the USB partition anywhere!
Should it be somewhere like /dev/, it isn't.
Should it be somewhere like /mnt/, it isn't.
If there was something like disk administrator/management I'd be able to see where it was, but there isn't.
Help!
 
Old 10-21-2007, 01:27 AM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
On my CentOS5 box (the equivalent of RH5), a usb drive appears as /dev/sdc or similar. This then needs to be mounted at the relevant spot

I use mount -a /dev/sdc /mnt/usb

but I guess you would need to use

mount -t ntfs /dev/sdc /mnt

(replace the relevant drive for sdc)

You should then be able to copy across

Note - fdisk -l should give you an idea of what device your usb drive is
 
Old 10-21-2007, 01:32 AM   #3
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by billymayday View Post
Note - fdisk -l should give you an idea of what device your usb drive is
The end of dmesg will also help.
 
Old 10-21-2007, 04:05 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
The mount command posted above isn't quite right because the device of a partition will look like /dev/sdc1 for the first partition on the /dev/sdc drive.

You can enter the root command "fdisk -l" to list the partitions detected. Since this is an ntfs drive, you might consider re-formatting it to another filesystem if you aren't using this drive for an xp computer. The vfat filesystem is better for sharing files between windows and Linux. A native filesystem should be used if you use drive for Linux.

Otherwise, check if you have the ntfs kernel module loaded:
/sbin/lsmod | grep ntfs

You may need to load the kernel module if not:
sudo /sbin/modprobe ntfs

Another way to find out which device is used is to monitor the kernel messages and then plug in the usb cable.

sudo tail -f /var/log/messages
It should mention which device was used.

Of course you could simply list the possible devices:
ls /dev/sd*

Typing "mount" by itself will show you which devices are currently mounted, so a process of elimination should tell you which device it is.
 
Old 10-21-2007, 04:14 AM   #5
jasee
LQ Newbie
 
Registered: Jun 2006
Posts: 27

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by billymayday View Post
On my CentOS5 box (the equivalent of RH5), a usb drive appears as /dev/sdc or similar. This then needs to be mounted at the relevant spot

I use mount -a /dev/sdc /mnt/usb

but I guess you would need to use

mount -t ntfs /dev/sdc /mnt

(replace the relevant drive for sdc)

You should then be able to copy across

Note - fdisk -l should give you an idea of what device your usb drive is
Thanks, this was a great help. All those graphical tools and I just _knew_ it would come down to the terminal window! ;-)
BTW is there a quick way of repeating what you type in a terminal window? Like f8 in windows?

There is a problem however which is it says fs type ntfs not supported by the kernel
 
Old 10-21-2007, 04:49 AM   #6
jasee
LQ Newbie
 
Registered: Jun 2006
Posts: 27

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jschiwal View Post
You may need to load the kernel module if not:
sudo /sbin/modprobe ntfs
Useful stuff snipped: thanks!

It looks like its not been included as when issuing the above command (do I need sudo as I'm logged in as root?) I get

Can't locate module ntfs
 
Old 10-21-2007, 06:14 AM   #7
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
jschiwal, the command works fine for a typical fat drive with only one partition (that is how I mount mine), but point taken
 
Old 10-21-2007, 06:17 AM   #8
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
jasee, linux is way better than windows for repeats. Hit the up arrow key - page up takes you to the first retained entry, page down to the last. How many depends on the distro, but there are 10's of previous commands available.

Rgds
 
Old 10-21-2007, 06:20 AM   #9
jasee
LQ Newbie
 
Registered: Jun 2006
Posts: 27

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by billymayday View Post
jasee, linux is way better than windows for repeats. Hit the up arrow key
Rgds
Thanks! great, but how do I read my ntfs usb disk?
 
Old 10-21-2007, 06:54 AM   #10
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
You don't use sudo if you are root. I will use sudo as a regular user to mount directories, but I must admit that I will su to root before examining log files in /var/log. Are you certain that you didn't use capital letters when you tried "modprobe ntfs".

I'm not familiar with your version of Red Hat. At one time, with Fedora Core 1, ntfs support was not enabled in the kernel by default. Since you didn't install it yourself, it could also be the case that the compiler was compiled from source by the previous user. You might want to search in the kernel's configuration file. If the kernel source is installed, look at the .config file. If this is the stock kernel, there may be a copy in /boot called config-<version>. Also if enabled there may be a /proc/config.gz file: "zcat /proc/config.gz | grep NTFS". Below is how my stock SuSE kernel is configured for NTFS:
If you want to write to the drive as well, use ntfs-3g as the filetype instead of ntfs. I think you need to first modprobe the fuse module, I'm not certain whether you need the ntfs module if you use ntfs-3g.

Code:
# DOS/FAT/NT Filesystems
#
CONFIG_FAT_FS=m
CONFIG_MSDOS_FS=m
CONFIG_VFAT_FS=m
CONFIG_FAT_DEFAULT_CODEPAGE=437
CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
CONFIG_NTFS_FS=m
# CONFIG_NTFS_DEBUG is not set
CONFIG_NTFS_RW=y
If CONFIG_NTFS_FS is commented out, you don't have NTFS support compiled in the kernel. Either reconfigure the kernel or install a kernel rpm that has it enabled.

---

I just mounted the Windows XP partition on my harddrive. It is /dev/sda1, and the mount-point is /mnt/xp.
Code:
sudo mount -t ntfs-3g /dev/sda1 /mnt/xp -o rw,uid=jschiwal,gid=jschiwal,fmask=0117,dmask=0007
jschiwal@hpamd64:~> ls -ld /mnt/xp
drwxrwx--- 1 jschiwal jschiwal 24576 2007-10-21 02:59 /mnt/xp
Code:
/dev/sda1 on /mnt/xp type fuseblk (rw,nosuid,nodev,noatime,allow_other,default_permissions,blksize=4096)
There is a manpage for ntfs-3g (man 8 ntfs-3g") that contains a list of the mount options. You need either to use the "uid=" mount option to make yourself the owner of the mounted partition, or use "fmask=111,dmask=000" and access the drive as "o"thers.

Good Luck!

Last edited by jschiwal; 10-21-2007 at 06:59 AM.
 
Old 10-21-2007, 12:47 PM   #11
jasee
LQ Newbie
 
Registered: Jun 2006
Posts: 27

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jschiwal View Post
I'm not familiar with your version of Red Hat. At one time, with Fedora Core 1, ntfs support was not enabled in the kernel by default. Since you didn't install it yourself, it could also be the case that the compiler was compiled from source by the previous user. You might want to search in the kernel's configuration file. If the kernel source is installed, look at the .config file. If this is the stock kernel, there may be a copy in /boot called config-<version>. Also if enabled there may be a /proc/config.gz file: "zcat /proc/config.gz | grep NTFS". Below is how my stock SuSE kernel is configured for NTFS:
If you want to write to the drive as well, use ntfs-3g as the filetype instead of ntfs. I think you need to first modprobe the fuse module, I'm not certain whether you need the ntfs module if you use ntfs-3g.

Code:
# DOS/FAT/NT Filesystems
#
CONFIG_FAT_FS=m
CONFIG_MSDOS_FS=m
CONFIG_VFAT_FS=m
CONFIG_FAT_DEFAULT_CODEPAGE=437
CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
CONFIG_NTFS_FS=m
# CONFIG_NTFS_DEBUG is not set
CONFIG_NTFS_RW=y
If CONFIG_NTFS_FS is commented out, you don't have NTFS support compiled in the kernel. Either reconfigure the kernel or install a kernel rpm that has it enabled.

There is a manpage for ntfs-3g (man 8 ntfs-3g") that contains a list of the mount options. You need either to use the "uid=" mount option to make yourself the owner of the mounted partition, or use "fmask=111,dmask=000" and access the drive as "o"thers.
Thanks for your advice, however you do realise you are talking to a Linux newbie? A lot of this stuff is completely over my head. At terminal prompt I did "zcat /proc/config.gz | grep NTFS" and I got no such file or directory. I also did mount -t ntfs-3G /dev/sdd1 /mnt and I got fs type ntfs-3g not supported by the kernel. So I presume this isn't there either? Not that I need to write to that partition - only read.
So it looks as though I have to "recompile the kernel", whatever that is?
Help!
 
Old 10-21-2007, 02:28 PM   #12
nkd
Member
 
Registered: Oct 2006
Location: india
Distribution: fedora 8, ubuntu 10.10
Posts: 315

Rep: Reputation: 34
hi jasee,
I understand you are a newbie....
I will put it simply - you donot have ntfs support in your default linux instln (kernel) . Either you fix it or get a new kernel.
If you wish to upgrade your kernel let me know , I will walk you through that and you will have ntfs support. Then you can think of the fdisk -l and the partition stuff to mount it.
bye
nishith
 
Old 10-21-2007, 02:45 PM   #13
jasee
LQ Newbie
 
Registered: Jun 2006
Posts: 27

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by nkd View Post
hi jasee,
I understand you are a newbie....
I will put it simply - you donot have ntfs support in your default linux instln (kernel) . Either you fix it or get a new kernel.
If you wish to upgrade your kernel let me know , I will walk you through that and you will have ntfs support.
Thanks, if you've got the time, I need to fix it
(not get a new kernel as this means a whole new version?, which I don't want).

I did realise that I (the operating system) didn't have ntfs support.

I don't know whether it's important, but I don't have any disks.

Last edited by jasee; 10-21-2007 at 02:49 PM.
 
Old 10-22-2007, 01:27 PM   #14
nkd
Member
 
Registered: Oct 2006
Location: india
Distribution: fedora 8, ubuntu 10.10
Posts: 315

Rep: Reputation: 34
yeah sound's difficult at first but trust me it's simple.
Just go to kernel.org site and download the linux-2.6.22.6.tar.bz2 file from it.
This is all you need.
Then cd to /usr/src and execute the following command
tar -jxvf linux-2.6.22.6.tar.bz2
A lot of things will scroll past on your screen and when that stops you will have a dir linux-2.6.22.6 under /usr/src
cd to the dir and do the following
make menuconfig
it shall open up a menu driven program now scroll down to the filesystems item in the list and navigate in it to find out the FAT32 and NTFS support . you got to press Y to enable it.
once you are done just save and exit.
the commands to navigate and save and exit can be easily found by reading the prompts at the end of the screen.
next do
make
this will take some time and things will go past your screen
next do
make modules
next
make modules_install
next
make install
that's all reboot your system, you will see in grub or lilo a option called linux-2.6.22.6 just choose it and boot up
you are almost there and if you have been able to do this much get back here and we shall see you through the rest.
Is that okay ?
nishith
 
Old 10-22-2007, 02:58 PM   #15
jasee
LQ Newbie
 
Registered: Jun 2006
Posts: 27

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by nkd View Post
yeah sound's difficult at first but trust me it's simple.
Just go to kernel.org site and download the linux-2.6.22.6.tar.bz2 file from it.
This is all you need.
Then cd to /usr/src and execute the following command
tar -jxvf linux-2.6.22.6.tar.bz2
A lot of things will scroll past on your screen and when that stops you will have a dir linux-2.6.22.6 under /usr/src
cd to the dir and do the following
make menuconfig
it shall open up a menu driven program now scroll down to the filesystems item in the list and navigate in it to find out the FAT32 and NTFS support . you got to press Y to enable it.
once you are done just save and exit.
the commands to navigate and save and exit can be easily found by reading the prompts at the end of the screen.
Thanks very much for your help, I've got this far. (But I've not enabled fat32 as I don't need it). I've got a whole lot of apparent error messages of the form "warning trying to assign nonexistent symbol etc..."

Can you tell me what I'm doing after this step, am I replacing the kernel or will I be able to boot into the alternative configurations when I boot up?

Last edited by jasee; 10-22-2007 at 03:02 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't install GNU/Linux after connecting external USB harddrive. NomDeGuerre Linux - Newbie 23 01-15-2008 03:09 AM
External harddisk (USB) not mounted robbbert Linux - Hardware 9 08-14-2006 07:43 AM
Canīt write to external USB harddisk fhjulfor Linux - Hardware 1 11-08-2004 12:33 PM
USB 2.0 and external harddisk crash mysterious Linux - Hardware 2 11-05-2003 06:50 AM
Installing Linux on USB External Harddisk compatible to HP Laptop yogesh_chitnis Linux - Hardware 0 04-17-2002 09:34 PM


All times are GMT -5. The time now is 12:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration