Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't view files in external HD 2

Status
Not open for further replies.

brokenhalo

IS-IT--Management
Feb 24, 2008
169
0
0
US
Hey guys,

Just to start, I am fairly new in the linux world, so with this question, please excuse what seems to be my ignorance... I have a web server on CentOS 4.4. I have attached a 500GB external hard drive. I want to mount this drive, but before I do that, I have to figure out what drive it is. I have checked the /dev folder and noticed that there is sda, sda1, sda2, sdb and sdb1... I am not sure which drive is the one I just attached... I tried the df command and here is what I got...


[root@host ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
115952076 24250252 85811776 23% /
/dev/sda1 101086 9288 86579 10% /boot
none 647372 0 647372 0% /dev/shm


Again, I have not mounted the drive yet, so I'm not sure if it would even be on the list above. My main goal is to use this drive as backup for websites that I host because ftp isn't working as I planned it. If anyone can help me to mount and be able to view files and save files to this drive it would be greatly appreciated. Thanks!

Brad L. - MCP

"If the doctors told me I had 5 minutes to live, I would type faster.
 
Try doing a

Code:
$ dmesg | tail

This usually will reveal what was mapped to the device you just plugged in.

When you go to mount it, you will need to tell it to allow your user to read/write. To identify this, use

Code:
$ whoami
<user>
$ cat /etc/passwd | grep <user>
<user>:x:1000:1000:User Name:/home/<user>:/bin/bash

The first number (in this case, 1000) is the user number you need. Then mount the device (as an example):

Code:
$ mount -o uid=1000 /dev/<device> /mnt/usb
 
Okay, I found the device (happened to be /dev/sdb1) and i tried to mount it but to no avail... I kinda figured Linux doesn't support NTFS file systems. I need to make this external HD available in linux so new question... How do I make this drive or change the file system on this drive so Linux will recognize it??? Thanks!

Brad L. - MCP

"If the doctors told me I had 5 minutes to live, I would type faster.
 
Linux has supported NTFS filesystems for a few years, now. I don't know about CentOS 4.4 specifically, but if it's relatively recent (looks like it's 2006-ish?), I'd expect it to support NTFS.

So the real question is: why did your attempt to mount it fail? What command did you try and what error did you get?
 
I tried to mount sdb and sdb1 (just in case) and heres what I got...


[root@host ~]# mount /dev/sdb /mnt/usbdrive
mount: you must specify the filesystem type
[root@host ~]# mount /dev/sdb1 /mnt/usbdrive
mount: fs type ntfs not supported by kernel


As you can see, when mounting sdb, it says I must specify the filesystem type which I find odd because it gives me an error telling me that the filesystem type isn't supported when trying to mount sdb2 (same command). IDK, any help is still appreciated...

Brad L. - MCP

"If the doctors told me I had 5 minutes to live, I would type faster.
 
/dev/sdb is the entire disk; it has no filesystem, so mount can't tell what filesystem it should be mounting. /dev/sdb1 and /dev/sdb2 are partitions; those apparently do have filesystems it recognizes as NTFS, so it is able to complain that it is unsupported.


Run:
Code:
uname -r
That tells you your current kernel version; what is it?

Run:
Code:
ls -A /boot
Do you see any files named [tt]config-something[/tt] or [tt].config-something[/tt]? Try to find one corresponding to your current kernel version and run:
Code:
grep NTFS /boot/config-[i]whatever[/i]
What's the output?


It looks like CentOS 4.4 is probably from 2005 or earlier, so it may be a bit too old to have support for NTFS.

Does CentOS have any newer kernel packages available for you to install on 4.4? If you have yum, you can probably run:
Code:
yum list available |egrep 'linux|kernel'
to see what's available. Otherwise, look wherever you normally look for package updates.
 
If you don't want to carry on using NTFS on the drive a just want it for Linux then reformat is as ext3.

# fdisk /dev/sdb
command (m for help): p
this will display the current partitions.
command (m for help): d
to delete the existing partition
command (m for help): n
this will prompt for various information to add the new partition(s).
command (m for help): w

You now have a usable partition you need to format it with a file system:

# mke2fs -j -L 'label' /dev/sdb1 (2/3/4 - depends how many partitions you want to create).

You can then mount the disk:

# mkdir /data1

# mount -t ext3 /dev/sbd1 (or 2 or 3, etc) /data1

You should be able to access the disk.



Lee Mason
Optimal Projects Ltd
 
Note that the above will not preserve any existing data on your disk.
 
In addition to not preserving the above, it won't be usable with Windows anymore.

You could probably format it as FAT32 if you need access both in Windows and linux. However, Windows places a 32GB partition limit on FAT32 devices, and there is no such limit if you use linux's tools to format.
 
Thank you guys for all of your help... I would really like to update the kernel, but I'm not sure if I should... Our web servers (the ones I am trying to attach these drives to) have 99.9% uptime, and I don't think it would be worth the reboot, I may end up with a lot of really pissed customers, although I am considering it... I'm pretty sure I will just reformat the disk to ext3, I would like to swap it between windoze and Linux, but it's not necessary. Thank you guys for all of your help, these forums have saved my job a few times :)

Brad L. - MCP

"If the doctors told me I had 5 minutes to live, I would type faster.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top