Making FAT play nice

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Making FAT play nice

Nick Guenther
I dual boot OpenBSD with Windows and have a third partition for data
which is mounted on /home. The data partition is FAT32 since that's
the only type that both OSes support well.

# fdisk wd0
Disk: wd0       geometry: 2432/255/63 [39070080 Sectors]
Offset: 0       Signature: 0xAA55
         Starting       Ending       LBA Info:
 #: id    C   H  S -    C   H  S [       start:      size   ]
------------------------------------------------------------------------
 0: 0B    1   0  1 -  636 254 63 [       16065:    10217340 ] Win95 FAT-32
*1: A6  637   0  1 - 1273 254 63 [    10233405:    10233405 ] OpenBSD
 2: 0C 1274   0  1 - 2430 254 63 [    20466810:    18587205 ] Win95 FAT32L
 3: 00    0   0  0 -    0   0  0 [           0:           0 ] unused

My problem, though, is with permissions. If I'm not logged in as root
I can't write on /home which kind of defeats the purpose of reserving
/home for user directories.

I read up on mount_msdos and saw that it gives all files on
filesystems mounted with it the permissions of how it was mounted,
which can be changed with the -u and -g options, so I tried
#mount_msdos -u kousu /dev/wd0h /home
#su kousu
$touch /home/kousu/test
and it works

However I would not like to restrict it to just one user, so I'd like
to mount it with the 'users' group and put all my user accounts in
there so they can edit their files (and other people's too, but that's
not much of an issue since this is just my own personal laptop).
Before trying to chgrp /home I just went on the fact that 'kousu' is
already in 'wheel' and mounted it, but then realized that /home
doesn't let the group write to it:

# ls -l / | grep home
drwxr-xr-x   1 root  wheel     8192 Dec 31  1979 home

I unmounted /home again and tried to change the permissions on it:
#chmod g+w /home
but it says "chmod: /home: is a directory". I don't understand this
error, if I do:
#mkdir /p
#chmod g+w /p
there is no problem.

So my two questions are:
1) how can I set the permissions on /home|why can't I set them?
2) how can I make it mount /home under a different user than root? I
don't see where I can pass options like that from fstab? Should I just
edit /etc/rc or whatever and find the mount section and add in my
explicit mount_msdos call?

It would be nice if I could make this work because this is a common
setup I make for most of my computers so that I can run OpenBSD
without getting people annoyed at me for being different (although KDE
makes it almost possible to finally kick windows forever).
Any pointers are greatly appreciated,
-Nick

Reply | Threaded
Open this post in threaded view
|

Re: Making FAT play nice

Andrew Davies
I can be done, have a look at man mount_msdos that should be all you need
it can be done. have a look at the examples in man fstab to see how you
use them.

On Mon, January 30, 2006 6:59 pm, Nick Guenther said:

> So my two questions are:
> 1) how can I set the permissions on /home|why can't I set them?
> 2) how can I make it mount /home under a different user than root? I
> don't see where I can pass options like that from fstab? Should I just
> edit /etc/rc or whatever and find the mount section and add in my
> explicit mount_msdos call?
content by MailScanner, and is believed to be clean.
MailScanner thanks transtec Computers for their support.

Reply | Threaded
Open this post in threaded view
|

Re: Making FAT play nice

Ted Unangst-2
In reply to this post by Nick Guenther
On 1/30/06, Nick Guenther <[hidden email]> wrote:

> My problem, though, is with permissions. If I'm not logged in as root
> I can't write on /home which kind of defeats the purpose of reserving
> /home for user directories.
>
> I unmounted /home again and tried to change the permissions on it:
> #chmod g+w /home
> but it says "chmod: /home: is a directory". I don't understand this
> error, if I do:
> #mkdir /p
> #chmod g+w /p
> there is no problem.

msdos doesn't support permissions, so you can't do this.  error
message is perhaps inappropriate, though.

i think what you want is to just mount with -m 0777 or -m 0666 -x.

Reply | Threaded
Open this post in threaded view
|

Re: Making FAT play nice

Alexander Hall
In reply to this post by Nick Guenther
Nick Guenther wrote:
> I dual boot OpenBSD with Windows and have a third partition for data
> which is mounted on /home. The data partition is FAT32 since that's
> the only type that both OSes support well.

I am not rally happy to use FAT partitions from OBSD. There has been
recently fixed issues, and I seem to stumble over corruptions from time
to time, and although I cannot be sure that FAT is to blame, I have no
issues when using non-FAT partitions.

See the archives for details.

> So my two questions are:
> 1) how can I set the permissions on /home|why can't I set them?

You cannot. It is not supported by the file system.

> 2) how can I make it mount /home under a different user than root? I
> don't see where I can pass options like that from fstab? Should I just
> edit /etc/rc or whatever and find the mount section and add in my
> explicit mount_msdos call?

 From my /etc/fstab:
/dev/wd0p /data msdos rw,-l,-m=777,nodev,nosuid,noauto 0 0

You can add switches like "-m" above.

/Alexander

Reply | Threaded
Open this post in threaded view
|

Re: Making FAT play nice

Nick Guenther
On 2/1/06, Alexander Hall <[hidden email]> wrote:
> Nick Guenther wrote:
> > I dual boot OpenBSD with Windows and have a third partition for data
> > which is mounted on /home. The data partition is FAT32 since that's
> > the only type that both OSes support well.
>
> I am not rally happy to use FAT partitions from OBSD. There has been
> recently fixed issues, and I seem to stumble over corruptions from time
> to time, and although I cannot be sure that FAT is to blame, I have no
> issues when using non-FAT partitions.

Hmm, I know it's not the greatest set up but it lets both OSes live
reasonably harmoniously.

> > 1) how can I set the permissions on /home|why can't I set them?
>
> You cannot. It is not supported by the file system.

>  From my /etc/fstab:
> /dev/wd0p /data msdos rw,-l,-m=777,nodev,nosuid,noauto 0 0
>
> You can add switches like "-m" above.
>

Ah! Thank you very much. That's exactly what I was looking for. That
little detail isn't explicitly documented anywhere I could see.

Also, I'm an idiot. I was trying to use chmod while /home was mounted.
The following 'solved' my problem:
#umount /home
#chmod g+w /home
#mount -t msdos -g=users /dev/wd0h /home

Now since I added all my user accounts to the users group they can all
write to /home. Hooray!

Thank you everyone for your help.

-Kousu

Reply | Threaded
Open this post in threaded view
|

Re: Making FAT play nice

Stuart Henderson
On 2006/02/01 16:45, Nick Guenther wrote:
> > /dev/wd0p /data msdos rw,-l,-m=777,nodev,nosuid,noauto 0 0
> > You can add switches like "-m" above.
>
> Ah! Thank you very much. That's exactly what I was looking for. That
> little detail isn't explicitly documented anywhere I could see.

for future reference: all the fs types have their own mount_foo manpage;
most are xref'd from mount(8) under 'see also'.

Reply | Threaded
Open this post in threaded view
|

Re: Making FAT play nice

Alexander Hall
In reply to this post by Nick Guenther
Nick Guenther wrote:

> On 2/1/06, Alexander Hall <[hidden email]> wrote:
>
>>Nick Guenther wrote:
>>
>>>I dual boot OpenBSD with Windows and have a third partition for data
>>>which is mounted on /home. The data partition is FAT32 since that's
>>>the only type that both OSes support well.
>>
>>I am not rally happy to use FAT partitions from OBSD. There has been
>>recently fixed issues, and I seem to stumble over corruptions from time
>>to time, and although I cannot be sure that FAT is to blame, I have no
>>issues when using non-FAT partitions.
>
>
> Hmm, I know it's not the greatest set up but it lets both OSes live
> reasonably harmoniously.

Yeah. I have the same setup on this laptop. :-)
I try to avoid using that partition if I can, though (Thus the "noauto"
mount option).

>
>
>>>1) how can I set the permissions on /home|why can't I set them?
>>
>>You cannot. It is not supported by the file system.
>
>
>> From my /etc/fstab:
>>/dev/wd0p /data msdos rw,-l,-m=777,nodev,nosuid,noauto 0 0
                                                   ^^^^^^ :)
>>
>>You can add switches like "-m" above.
>>
>
>
> Ah! Thank you very much. That's exactly what I was looking for. That
> little detail isn't explicitly documented anywhere I could see.

Not too simple to spot it, but a combination of the following could give
you a hint:

 From fstab(5):
   The fourth field, fs_mntops, describes the mount options
   associated with the filesystem. It is formatted as a comma
   separated list of options. It contains at least the type of
   mount (see fs_type below) plus any additional options
   appropriate to the filesystem type.

 From mount(8):
   Any additional options specific to a given file system type
   (see the -t option) may be passed as a comma separated list;
   these options are distinguished by a leading ``-'' (dash).
   Options that take a value are specified using the syntax
   -option=value. For example, the mount command:

     # mount -t mfs -o nosuid,-s=4000 /dev/sd0b /tmp

   causes mount to execute the equivalent of:

     # /sbin/mount_mfs -o nosuid -s 4000 /dev/sd0b /tmp

> Also, I'm an idiot. I was trying to use chmod while /home was mounted.
> The following 'solved' my problem:
> #umount /home
> #chmod g+w /home
> #mount -t msdos -g=users /dev/wd0h /home

This is not really useful, since the properties of a mount point is
determined by the mounted file system. E.g:

$ ls -dlF /data
drwxr-xr-x  2 root  wheel  512 Sep  7  2004 /data/
$ sudo mount /data
$ ls -dlF /data
drwxrwx---  1 root  staff  4096 Jan  1  1980 /data/
$ grep data /etc/fstab

/dev/wd0p /data msdos rw,-l,-g=staff,-m=770,nodev,nosuid,noauto 0 0

> Now since I added all my user accounts to the users group they can all
> write to /home. Hooray!
>
> Thank you everyone for your help.

NP! :)

/Alexander

viq
Reply | Threaded
Open this post in threaded view
|

Re: Making FAT play nice

viq
In reply to this post by Nick Guenther
On Tuesday 31 January 2006 02:59, Nick Guenther wrote:
> I dual boot OpenBSD with Windows and have a third partition for data
> which is mounted on /home. The data partition is FAT32 since that's
> the only type that both OSes support well.

Just an idea, I didn't try it, but... http://www.fs-driver.org/ 

--
viq

----------------------------------------------------------------------
Kobiety i samochody... piekne! >>> http://link.interia.pl/f18f5