PDA

View Full Version : Unable to write on FAT32 partition as regular user



finferflu
06-16-2006, 04:00 PM
Hi,

I am currently using Knoppix 5.0.1, HD install, and I am trying to write to my FAT32 partition in order to store some files I want to download with Bittorrent. But when I try to do so, I receive an error message:


Failed to create directory /media/hda1/directory

(Do you have the required permissions?


This is my mount output regarding /media/hda1:


/dev/hda1 on /media/hda1 type vfat (rw)

where I guess that rw means that it is mounted as read-write, and not read-only.

I also tried to change the permission both on command line (chmod 777 /media/hda1), and on the properties menu (right-click on the icon), but I got no results. And I also tried to click on "Change read/write mode" on the right-click menu of the hda1 icon on my desktop, getting no results.
Then I tried to change the group of the folder to users, and this is what I got:


root@scatoletta:/home/mmanu# chgrp users /media/hda1
chgrp: changing group of `/media/hda1': Operation not permitted

At the end I tried just to create a folder in /media/hda1 to be sure that my problem was not caused by Bittorrent:


mmanu@scatoletta:/media/hda1$ mkdir new
mkdir: cannot create directory `new': Permission denied


At this point I am short of ideas, and I don't understand what is going on.

Any suggestion?

Thank you for your time.

malaire
06-16-2006, 05:35 PM
You could try this:


sudo mount -o remount,uid=knoppix,gid=knoppix /dev/hda1

This sets "knoppix" to be the owner of all files in /dev/hda1, and then you should be able to use them without permission errors.



root@scatoletta:/home/mmanu# chgrp users /media/hda1
chgrp: changing group of `/media/hda1': Operation not permitted

IMHO, FAT32-partitions can't save the owner & group information, so commands like chgrp are probably useless for FAT32 partitions.



mmanu@scatoletta:/media/hda1$ mkdir new
mkdir: cannot create directory `new': Permission denied

When you get permission-problems, you could also test


sudo mkdir new

to know if root-user can create a directory there or not.

finferflu
06-16-2006, 05:53 PM
Ok, I have done as you suggested, but had the same results. I have already checked wheter I could write on hda1as root-user, and there is no problem in doing that.

To be clear, I did not use the sudo command, but did everything under root, since my user seems not to appear in the sudoers file (and I need to study how to do that), but I don't think that this makes any difference...

malaire
06-16-2006, 06:01 PM
Ok, I have done as you suggested, but had the same results. I have already checked wheter I could write on hda1as root-user, and there is no problem in doing that.

To be clear, I did not use the sudo command, but did everything under root, since my user seems not to appear in the sudoers file (and I need to study how to do that), but I don't think that this makes any difference...
Sorry, I didn't realize you are not using user "knoppix".

So if your username is "mmanu" you need to use


mount -o remount,uid=mmanu /dev/hda1

If that doesn't work, could you tell
- What is the output from that command?
- What is the output from "mount" after that command?

finferflu
06-16-2006, 06:50 PM
well, I knew I had to write mmanu in the place of knoppix, and so I did.

this is the output:


root@scatoletta:/media/hda1# mount -o remount,uid=mmanu,gid=mmanu /dev/hda1
root@scatoletta:/media/hda1#

(no output)

and


root@scatoletta:/media/hda1# mount
/dev/hda2 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
usbfs on /proc/bus/usb type usbfs (rw,devmode=0666)
tmpfs on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
automount(pid6264) on /mnt/auto type autofs (rw,fd=4,pgrp=6264,minproto=2,maxproto=4)
/dev/hda1 on /media/hda1 type vfat (rw,nosuid,nodev,umask=000,shortname=winnt,uid=kno ppix,gid=knoppix,uid=1000,gid=1000)


it seems that it didn't quite accept my command...

malaire
06-17-2006, 03:02 PM
/dev/hda1 on /media/hda1 type vfat (rw,nosuid,nodev,umask=000,shortname=winnt,uid=kno ppix,gid=knoppix,uid=1000,gid=1000)


it seems that it didn't quite accept my command...
That seems strange, as there's two values for uid & gid.

Unfortunately I don't have space on my HD to create a FAT32-partition for testing, but here is an additional idea:

Check your numeric uid & gid with


knoppix@2[knoppix]$ id
uid=1000(knoppix) gid=1000(knoppix) groups=20(dialout),21(fax),22(voice),24(cdrom), .....

Most likely that will tell uid=1000 gid=1000. Then umount & mount the partition to some other place:


umount /media/hda1
mkdir /home/mmanu/hda1
mount -t vfat -o uid=1000,gid=1000 /dev/hda1 /home/mmanu/hda1

And after that check output from "mount" to see if it has options "uid=1000,gid=1000"

finferflu
06-17-2006, 03:16 PM
Yes, this time it worked fine.

And this is my mount output that interests us:


/dev/hda1 on /home/mmanu/hda1 type vfat (rw,uid=1000,gid=1000)


Now, the last question is, do I have to do this everytime?


Thanks a lot for your help so far ^__^

malaire
06-17-2006, 04:00 PM
Yes, this time it worked fine.

And this is my mount output that interests us:


/dev/hda1 on /home/mmanu/hda1 type vfat (rw,uid=1000,gid=1000)


Now, the last question is, do I have to do this everytime?


Could you first show the contents of /etc/fstab file. (I'm mainly interested about line(s) where hda1 is mentioned.)


cat /etc/fstab


Also, is /dev/hda1 currently mounted automatically when computer starts?

finferflu
06-17-2006, 04:06 PM
Ok, here it is:


mmanu@scatoletta:~$ cat /etc/fstab | grep hda1
/dev/hda1 /media/hda1 vfat noauto,users,exec,umask=000,shortname=winnt,uid=kn oppix,gid=knoppix 0 0

And, /dev/hda1 is not mounted automatically.

malaire
06-17-2006, 04:17 PM
Ok, here it is:


mmanu@scatoletta:~$ cat /etc/fstab | grep hda1
/dev/hda1 /media/hda1 vfat noauto,users,exec,umask=000,shortname=winnt,uid=kn oppix,gid=knoppix 0 0

And, /dev/hda1 is not mounted automatically.
You could first try changing that "uid=knoppix,gid=knoppix" to "uid=1000,gid=1000" and keeping the rest as is.
Then try


umount /dev/hda1
mount /dev/hda1

to see if that works.
(NOTE: If you give BOTH device AND directory to mount-command, then /etc/fstab is not used. If you only give one of them, then options are read from /etc/fstab)

Removing "noauto" option just might make it be automatically mounted on startup. If not, then I can't help on that.
"users" option means that you should be able to mount it as normal user.

finferflu
06-17-2006, 04:32 PM
Ok, it is working fine now, I mounted hda1 giving just the device, so that it read from /etc/fstab, and mounted it on /media/hda1.
I tried to create a folder as a normal user, and it worked, I am also downloading files with Bittorrent to hda1 with no trouble.

I removed the "noauto" option, and it works, hda1 is mounted automatically at the startup.

And, yes, I can now mount hda1 as a normal user :)


I really appreciate your help, thank you very much ^___^