PDA

View Full Version : Mounting a doze partition in Linux.



nz_liam
08-02-2003, 06:31 PM
I think i've asked this question a couple of time in the past actually :D:p.

What I want to do is mount my NTFS partition in Linux and map it to say /Windows, whats the command line I punch in to do this?


Cheers

Liam

Stumped Badly
08-02-2003, 07:10 PM
Liam,

You will have to create a mount point and add an entry to /etc/fstab for the NTFS partition you want to access.
Sample entry in /etc/fstab would look something like this:

/dev/hdc1 /mnt/winnt ntfs noauto,uid=700,gid=700,umask=007 0 0

You will have to edit this entry for your own use.
Don't know what distro you are using, but there should be info in the manpages for the "mount" & command which will explain the mount options available for the NTFS and other filesystems.

Stumped Badly
08-02-2003, 07:14 PM
Meant to add that if your running Redhat, you may have to download & install the RPM as I don't think it is installed by default.

Kame
08-02-2003, 08:32 PM
http://linux-ntfs.sourceforge.net/info/redhat.html

download the RPM for your Kernel version here. Instructions are also on here. This will install the module NTFS and you'll be able to mount drives by:

Instructions in installing the rpm is:

rpm -ivh <filename>.rpm
modprobe ntfs

fdisk -ls (to find NTFS partitions)

make sure you have a directory to mount to:

mkdir /mnt/hda1 (creates a directory in /mnt called hda1... can be called whatever you like e.g. Windows)

mount -t ntfs /dev/hda1 /mnt/hda1 (if hda1 is the NTFS drive and hda1 is the directory in /mnt you are mounting it too)

then to access it:

cd /mnt/hda1

and you'll be browsing your NTFS partition.

If you want to create an icon on your desktop you'll have to follow stumped's instructions in editing your /etc/fstab

keep it similar to the setup of the drives already present except remove kudzu since this is like an autodetect and it'll remove the NTFS partition because it'll not detect it, which will mean you'll need to re-edit the /etc/fstab file. Also make sure ro is on the end for read-only.

nz_liam
08-02-2003, 11:33 PM
Hi everyone, sorry if i didn't say, im running RedHat 8 wile all 1463 modules installed, (chose install everything at setup).

Im just reading through the posts now.


Cheers

Liam

nz_liam
09-02-2003, 12:19 AM
Well I downloaded the RPM kame suggested, installed it and mounted the partiton, an could browse and see all my files from the command prompt.

However because I created the /mnt/hda1 directory in the command prompt as su, the root now owns's the directory, (and only the root has access rights).


So I thought, simple fix, and did a chmod 770 /mtn/hda1 at the prompt as su, and it said 'changing permisions of '/mnt/hda1': Read-only file system', however I still can access it as a normal user, and when I browse to the directory in konqueror it still has the padlock siymbol, and of course when I try to open it I get a "you do not have permisions blah blah blah".


What did I do wrong??

Gorela
09-02-2003, 01:10 AM
Supposedly chmod -R 777 should give everyone full read/write/execute permission for the entire directory. It seems that by not adding the -R (recursive) chmod only applies to the first directory and nothing below it.

nz_liam
09-02-2003, 01:21 AM
That won't work, if you read above chmod 770 /mnt/hda1 didn't work, so 777 wont either, plus I don't want the directory globally readable writable, hence 770 instead of 777.

Gorela
09-02-2003, 01:47 AM
Okay,

it might still be worthwhile doing chmod -R 770 to see if that will actually allow the permition to go lower than the first directory.

nz_liam
09-02-2003, 01:54 AM
Well, um, not really, there isint any point I mean, cause its not working, something else is stuffing it up.

Off to get some sleep now.



Cheers

Liam

segfault
09-02-2003, 08:18 AM
> So I thought, simple fix, and did a chmod 770
> /mtn/hda1 at the prompt as su, and it said 'changing
> permisions of '/mnt/hda1': Read-only file system',
> however I still can access it as a normal user, and
> when I browse to the directory in konqueror it still
> has the padlock siymbol, and of course when I try to
> open it I get a "you do not have permisions blah blah
> blah".
>
>
> What did I do wrong??

Try it with the NTFS partition unmounted.

E.ric
09-02-2003, 09:35 AM
Thats very odd Linux can not see NTFS, it should read all formats, unlike Windoze,

I just go to
file:/mnt/win_c
or
file:/mnt/win_d
for that matter.

to see my fat 32 partitions

From Eric

nz_liam
09-02-2003, 02:39 PM
Ok, here whats happening.

While the drive is unmounted I can assess and change the permisions of the /mnt/hda1 directory, however once I mount /dev/hda1 to it the directory becomes locked to root, (even if it was set to 777 before it was mounted). When I chmod it back to 777 at the prompt it dosent work.

Could this be bacause it's a read-only filesystem, and im telling it to make it writable, which it can't do?

Graham L
09-02-2003, 02:55 PM
To make a disk mountable from non-root accounts add the option "user" to the /etc/fstab entry for the disk.

It's prudent to keep an NTFS disk read-only (the default probably has the "ro" option in /etc/fstab.) It is not a totally good idea to write from one OS to a disk owned by another OS. ;-) I don't think MS have published the full specifications for NTFS, so the implementation has to be reverse engineered.

nz_liam
09-02-2003, 04:14 PM
> To make a disk mountable from non-root accounts add
> the option "user" to the /etc/fstab entry for the
> disk.
>
> It's prudent to keep an NTFS disk read-only (the
> default probably has the "ro" option in /etc/fstab.)
> It is not a totally good idea to write from one OS to
> a disk owned by another OS. ;-) I don't think MS have
> published the full specifications for NTFS, so the
> implementation has to be reverse engineered.

Ok well I have /etc/fstab open, I assume I add in a line like "/dev/hda1 /mnt/hda1", but where exactily do I add the user bit, (sorry, but im new to this sorta thing).


Cheers

Liam

segfault
09-02-2003, 04:33 PM
> Ok well I have /etc/fstab open, I assume I add in a
> line like "/dev/hda1 /mnt/hda1", but where exactily
> do I add the user bit, (sorry, but im new to this
> sorta thing).

The other entries usually help when doing this, but here is what mine looks like: (Hope it comes out alright)

/dev/hda6 / reiserfs notail 1 1
none /dev/pts devpts mode=0620 0 0
none /mnt/cdrom supermount dev=/dev/hdc,fs=auto,ro,--,iocharset=iso8859-1,codepa
ge=850,umask=0 0 0
/dev/hda1 /mnt/nt ntfs iocharset=iso8859-1,ro,umask=0 0 0
192.168.1.3:/home/shared /home/shared nfs defaults 0 0
/dev/hda5 /mnt/lfs ext3 1 2
none /proc proc defaults 0 0
/dev/hda7 swap swap defaults 0 0

nz_liam
09-02-2003, 04:40 PM
Yea I see all that, but where do I slot the user bit in?????

Mine looks like;

LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/hda5 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0


Would I just add tha line;
/dev/hda1 /mnt/hda1 user

?????

Kame
09-02-2003, 07:54 PM
/dev/hda1 /mnt/hda1 ntfs noauto,user,ro 0 0

I assume. I'm not sure... I usually su to root when I need to mount drives

Graham L
10-02-2003, 02:58 PM
That's right. Have a look with "man fstab" (or "apropos fstab" if there isn't a man page for it :D)

It's:
<device> <mount point> <filesystem> <options> <two numbers which are to do with checking>

I wouldn't call its mount point "/mnt/hda1". ;-) I put such things at the root level, and with a meaningful name. You might use "/WinNTFS" or something like that. (That might not be in accordance with the standard file layout, but it saves me some typing. Guess which wins. ;-))

Another useful option is "noauto". The default is "auto" which means that the disk is mounted at boot time. That is a bad idea for floppies or CDs. If it's a fixed hard disk, it's probably best automounted (it doesn't use any resources).

If you use NFS to mount disks on other comoputers in your network, there are some other options which let it handle the other computer(s) being up and down.

Chilling_Silence
10-02-2003, 03:05 PM
If you've got a GUI (Which you should do having all packages installed)
type:
init 4 to get into it (may be init 5 - cant remember)

browse for the mount point and right-click on the folder
from there, set the permissions!

Graham L
10-02-2003, 03:44 PM
The permissions on the mount point are not the problem. The mount programme needs root privilege to mount a disk unless the disk has the user option set in fstab.

It is a security issue.

nz_liam
10-02-2003, 03:53 PM
Um, well I have still got the lock out problem. I changed loged in as root and changed my /etc/fstab to this;

LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/hda5 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0
/dev/hda1 /mnt/hda1 ntfs auto,user,ro 0 0

But when I reboot and login as liam, the disk is mounted ok, but im still locked out?!?!

What did I do wrong?

Graham L
10-02-2003, 04:07 PM
Make the mount point's permissions the same as those of, say, "bin". Check with "man chmod" about the mask, so the lower levels will inherit the proper permissions. The "world" rights are the important ones.

Chilling_Silence
10-02-2003, 04:10 PM
What happens if you change it to:
/dev/hda1 /mnt/hda1/ ntfs (Or should it be NTFS) defaults 0 0

Graham L
10-02-2003, 04:17 PM
That might work ... having it automount at boot (but using the user option) may have made it so that root is the user who owns it. If it's mounted at boot time, it does not need the user option. That affects the command line use of mount.

Chilling_Silence
10-02-2003, 04:24 PM
Would it be case-SeNSiTivE as well??? (for the NTFS part I mean?)

Kame
10-02-2003, 06:48 PM
The reason why I called it /mnt/hda1 in that format is because I have possibly 10 or more partitions and giving them special names to help remember is just as easy as looking at fdisk -ls and knowing which partition I want.

If I can't find what I want I've created all the hard drive shortcuts and have given them the drive letter of my Windows OS since that's easy for me to remember.

You basically set it up to how you'll understand it better.

Kame
10-02-2003, 06:49 PM
It's possibly case sensitive. All partitions shown are lower case so just keep it the same.