LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-01-2007, 05:12 PM   #1
fc6_user
Member
 
Registered: Jan 2007
Location: Montpellier, France
Distribution: Fedora Core 6, Mandriva, Knoppix, Debian
Posts: 143

Rep: Reputation: 15
Mounting Partitions and Associating Paths/Directories to Them


Prior to installation, I set up and formatted my partitions as follows:

[Primary partition: WindowsXP, NTFS, 60Gb - already installed]
Primary partition: FAT32, 3Gb - to share files between Linux OSs and Windows (read and write priviledges)
Extended partition:
LP1 ext3, 5Gb - for general data storage accessible from all Linux OSs
LP2 ext3, 14Gb - for Linux OS 1 (at this point Mandriva wasn't installed yet)
LP3 ext3, 14.5Gb - for Linux OS 2 (not installed yet, it'll be Debian)
LP4 ext3, 15Gb - for Linux OS 3 (not installed yet, not sure which distro I'll be putting here)
LP5 SWAP, 1Gb+ - single SWAP partition used by all Linux OSs

I then installed Mandriva.

I'd like to mount my 5Gb ext3 partition to /home/linux/lindata and my 3Gb FAT32 partition to /home/linux/windata.

I've tried doing so, but have had trouble with permissions and ownership (ownership becomes root when changing the fstab file).

Here is the contents of my fstab file:

/dev/hda6 / ext3 defaults 1 1
/dev/hdc /mnt/cdrom auto umask=0022,users,iocharset=utf8,noauto,ro,exec 0 0
none /mnt/floppy supermount dev=/dev/fd0,fs=ext2:vfat,--,umask=0022,iocharset=utf8,sync 0 0
/dev/hda1 /mnt/win_c ntfs umask=0022,nls=utf8,ro 0 0
/dev/hda2 /mnt/win_d vfat umask=0022,iocharset=utf8 0 0
none /proc proc defaults 0 0
/dev/hda9 swap swap defaults 0 0

What do I have to do to make it so that I'm (user 'linux') the only one who has access to the 5Gb ext3 partition (hda5, which I'd like to store and access via /home/linux/lindata) and the 3Gb FAT32 partition (which I'd like to store and access via hda2, /home/linux/windata)?

Many thanks
 
Old 05-01-2007, 05:37 PM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,310

Rep: Reputation: 139Reputation: 139
For hda5 put the following in fstab:

/dev/hda5 /home/linux/lindata ext3 defaults 1 2

Then open a console and run:

# mkdir /home/linux/lindata
# mount /dev/hda5
# chown -R linux /home/linux/lindata
# chmod -R 700 /home/linux/lindata


For hda2, edit the current fstab line for hda2 like so:

/dev/hda2 /home/linux/windata vfat umask=0022,iocharset=utf8 0 0

Then in your root console, run:

# mkdir /home/linux/windata
# umount /dev/hda2
# mount /dev/hda2
# chown linux /home/linux/windata
# chmod 700 /home/linux/windata
 
Old 05-02-2007, 09:24 AM   #3
fc6_user
Member
 
Registered: Jan 2007
Location: Montpellier, France
Distribution: Fedora Core 6, Mandriva, Knoppix, Debian
Posts: 143

Original Poster
Rep: Reputation: 15
Many thanks kilgoretrout!

The first operation went perfectly. I tried it out and everything, moving files around and seeing if the used and available partition space changed in size as I added and deleted files. The owner is linux, but the group is still root. Should I also change the group to linux as well? If so, how?

The second operation didn't go so well, in fact, it didn't work. I then noticed that there were some files in the windata directory (I certainly didn't put them there!!). I thought it'd be a wise decision to consult you before simply deleting them. Here's what's in the windata directory:

Directories 'Recycled' (contains desktop.ini and info2 files) and 'System Volume Information'.

The System Volume Information directory contains several directories:

System Volume Information -> _restore{661...(hexadecimal, very long and separated by dashes)} -> rp593 -> change.log1 and RestorePointSize files

Can I just delete all of this and change ownership and permissions? What's strange is that I repartitioned and reformatted that specific partition myself. Perhaps that Windows adds files and directories to this partition by default. How could I check and see how this partition is mounted within the Windows OS?

Oh, and lastly, what happens if the partition is full and I inadvertently try to add more files? Can this cause damage to other partitions? Is there a way of limiting the amount of data that can be put onto this partition? I mean, is there a way of getting the system to give me some sort of warning message so that I don't do so or so that I realize what's happening?

From my understand of it, the FAT32 partition allows me to read and write from both Linux and Windows OSs. Is that right?

Thanks again for the very clear and concise information!
 
Old 05-02-2007, 10:11 AM   #4
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,310

Rep: Reputation: 139Reputation: 139
Windows puts those files in each windows partition that it recognizes; it's completely normal AFAIK. Just leave them alone.
Are you able to read and write to hda2 through /home/linux/windata?

Also, post the output of this command:

$ mount

That will list all mounted partitions and their mount points.

To answer some of your questions, both windows and linux can read and write to FAT32. If hda2 is properly mounted at your new mount point, if you copy a file into /home/linux/windata and boot into windows you will see the copied file in the drive letter windows gives to hda2,probably D or E.

For hda5, you can change the group to linux if you want, but it doesn't make any difference:

# chown -R linux:linux /home/linux/lindata

hda5 is set up so only the user linux has rwx permissions on the partition, i.e. no other ordinary user will be able to read what's there. However, root can read and write everywhere for the most part.

I think you are a little confused about FAT32 in linux. All files on a linux system must have an owner and a group and and each of those can have designated read, write and execute(rwx) permissions with respect to the file. However, FAT32 has no native permission structure like that; it's a pretty primitive filesystem. To get around this problem, linux grafts on a permission structure to the FAT32 partition when it's mounted. This is controlled through the "umask" parameter in the fstab entry. Once umask sets that permission structure, it can't be changed, i.e. you can't change the permissions on the files in the FAT32 partition or the read/write permissions on the partition itself without changing umask and remounting; it's all set through the umask parameter.

Native linux filesystems don't work that way and you just need to recursively change permissions on the mountpoint with the partition mounted to change read/write permissions on the partition.

You wanted hda2 set up so only the user linux could see it's contents. I attempted to accomplish that, by giving only the user, linux rwx permissions on the mount point, i.e. other non-root users would not be allowed to go into(read) /home/linux/windata. This is allowed since /home/linux/windata is a file on a native linux filesystem even though it serves as a mountpoint for your FAT32 partition.

Re filling up/overfilling the partition - don't worry. Linux won't let you do that. You will start to get warnings as soon as the partition gets filled up to a certain level and linux will refuse to write to a partition where there is insufficient space to accommodate the write.
 
Old 05-02-2007, 05:15 PM   #5
fc6_user
Member
 
Registered: Jan 2007
Location: Montpellier, France
Distribution: Fedora Core 6, Mandriva, Knoppix, Debian
Posts: 143

Original Poster
Rep: Reputation: 15
kilgoretrout,

I thought everything was okay, but actually, some pretty weird stuff has been happening since I last booted my computer... lindata and windata are now owned by root again (not my doing!), and I can no longer access my Windows partition!! The NTFS one!! The one that didn't present any problem whatsoever!

Not a big deal. The worst would be reinstalling everything, but I think I'm far from having to do that...

Help! I need help!!

Many thanks for your efforts, but...
 
Old 05-02-2007, 11:06 PM   #6
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,310

Rep: Reputation: 139Reputation: 139
If you are using mandriva, check the security level by running as root:

# draksec

If it's set to anything greater than "High", you are likely to have problems. Try reseting the security level to "Standard" and reboot for this to take effect.

Draksec is mandriva's security utility which you can set to certain specified levels. Draksec runs in the background and periodically checks many things for suspicious activity and changes. At the higher security levels, one of the things it checks are read/write permissions on partitions. At the "Higher" and "Paranoid" levels, it will make all windows partitions only readable by root IIRC. If you try to change it, draksec will change it back at those upper levels. This can be very annoying and puzzling because draksec makes it's checks at certain specified intervals. You can make the changes you want re partition permissions, etc and then draksec will run in the background some time later and change it back. It will certainly do so on a reboot.
 
Old 05-02-2007, 11:43 PM   #7
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
The instructions for the vfat partition is wrong.
Code:
For hda2, edit the current fstab line for hda2 like so:

/dev/hda2 /home/linux/windata vfat umask=0022,iocharset=utf8 0 0

Then in your root console, run:

# mkdir /home/linux/windata
# umount /dev/hda2
# mount /dev/hda2
# chown linux /home/linux/windata
# chmod 700 /home/linux/windata
You can't use chown and chmod on a fat32 partition. Make the changes in /etc/fstab instead.
Code:
/dev/hda2 /home/linux/windata vfat umask=0007,iocharset=utf8,uid=linux,gid=linux,user 0 0
or
/dev/hda2 /home/linux/windata vfat umask=0077,iocharset=utf8,uid=linux,gid=users,user 0 0
The "user" option isn't needed if you don't use the "noauto" option. It allows the user ("linux") to mount and umount the partition without having to use sudo. However, if it is on an internal drive and mounted at boot time, you don't need to do that anyway. The uid and sid options determine the owner and group of the mounted partition. The umask masks out permissions for group and others. On some distro's such as Mandriva, a user's primary group is the same as the username. For others, it is "others" for all users. That is why I supplied two examples. You might want to use "fmask=0177,dmask=0077" instead of "umask=0077". This allows you to disallow files being executed from the windows partition. However for directories the "x" bit has a different meaning, and is needed to enter a directory. Hence, the two separate options instead of just one.

This only restricts access to the fat32 partition when running Linux. When running windows, everyone has access. I think that you need ntfs to add that kind of control.

Last edited by jschiwal; 05-02-2007 at 11:46 PM.
 
Old 05-14-2007, 08:32 AM   #8
fc6_user
Member
 
Registered: Jan 2007
Location: Montpellier, France
Distribution: Fedora Core 6, Mandriva, Knoppix, Debian
Posts: 143

Original Poster
Rep: Reputation: 15
Sorry I didn't get back to you guys sooner, I was away for a week and a half.

kilgoretrout,

Thanks for the advice on the security settings. I did make the changes and will do some more experimenting to see what happens. So far things are working better. For example, I can now access my Windows NTFS partition from Mandriva, which was hit and miss before. I'll have to keep trying it out for a few days though to know if it's really working properly.


jschiwal,

Thanks too for your post. I couldn't figure out how the vfat partition in the fstab file should read. Could you write it out? When I copied what was in the post, my text editor wasn't very happy (last part in underlined and in red... the user 0 0 stuff... That's probably what you were referring to, but I can't figure out what needs to be put there). This is what is how my vfat line reads in my fstab file:

/dev/hda2 /home/linux/windata vfat user,auto,rw,exec 0 0

I cannot write to my windata directory and there are two directories in it. One's called "Recycled" and the other "System Volume Information". Why are they there? Do I have to go into Windows and change the default settings there?


Do you (or any other readers) have any links you could send me to learn more about all of this? I'm looking for something very basic, clear... for the linux beginner.

Many thanks again.
 
Old 05-16-2007, 12:06 PM   #9
fc6_user
Member
 
Registered: Jan 2007
Location: Montpellier, France
Distribution: Fedora Core 6, Mandriva, Knoppix, Debian
Posts: 143

Original Poster
Rep: Reputation: 15
Hi all!

Yeah, I've had a closer look at this thread and I have tried everything. Whatever I try, impossible to save files on my 5Gb VFAT32 Partition. Impossible to change groups, ownership, etc. too.

I've googled it a bit and learned more about fstab, but just can't figure it out!

Uhrrg!!!

The security settings have been changed to 'normal', and I've tried every suggestion in the thread regarding the fstab file.

Thanks to all nevertheless...
 
  


Reply

Tags
mount


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Symbolic Links, directories, and relative paths (../). Can it be done? jimwillsher Linux - Newbie 1 03-11-2005 05:27 PM
Directories on seperate partitions. ToothlessRebel Linux - Newbie 5 11-27-2004 09:34 AM
recursively listing directories full paths kubicon Linux - Newbie 2 02-22-2004 03:55 PM
Moving directories to their own partitions bxb32001 Debian 7 12-08-2003 06:40 AM
Automatically resolving WINDOWS paths to pre-configured Linux paths gazzy Linux - General 1 09-05-2003 10:15 PM


All times are GMT -5. The time now is 09:27 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration