LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Connecting àn external harddisk via usb to Redhat Linux (https://www.linuxquestions.org/questions/linux-newbie-8/connecting-%E0n-external-harddisk-via-usb-to-redhat-linux-593395/)

jasee 10-21-2007 12:19 AM

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!

billymayday 10-21-2007 12:27 AM

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

Nylex 10-21-2007 12:32 AM

Quote:

Originally Posted by billymayday (Post 2931298)
Note - fdisk -l should give you an idea of what device your usb drive is

The end of dmesg will also help.

jschiwal 10-21-2007 03:05 AM

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.

jasee 10-21-2007 03:14 AM

Quote:

Originally Posted by billymayday (Post 2931298)
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

jasee 10-21-2007 03:49 AM

Quote:

Originally Posted by jschiwal (Post 2931363)
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

billymayday 10-21-2007 05:14 AM

jschiwal, the command works fine for a typical fat drive with only one partition (that is how I mount mine), but point taken

billymayday 10-21-2007 05:17 AM

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

jasee 10-21-2007 05:20 AM

Quote:

Originally Posted by billymayday (Post 2931435)
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?

jschiwal 10-21-2007 05:54 AM

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!

jasee 10-21-2007 11:47 AM

Quote:

Originally Posted by jschiwal (Post 2931455)
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!

nkd 10-21-2007 01:28 PM

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

jasee 10-21-2007 01:45 PM

Quote:

Originally Posted by nkd (Post 2931794)
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.

nkd 10-22-2007 12:27 PM

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

jasee 10-22-2007 01:58 PM

Quote:

Originally Posted by nkd (Post 2932746)
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?


All times are GMT -5. The time now is 03:14 AM.