Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This is a strange problem. I have the following partition table

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      102400    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2              13        5737    45978624    7  HPFS/NTFS
/dev/sda3            5738       10600    39062047+  83  Linux
/dev/sda4           10601       19457    71143852+   5  Extended
/dev/sda5           10601       11208     4883728+  82  Linux swap / Solaris
/dev/sda6           11209       15033    30720000    b  W95 FAT32
/dev/sda7           15033       19457    35537920    7  HPFS/NTFS

I dual boot Win7 (sda2) and Ubuntu (sda3) and wanted to use the FAT23 partition to share files across two OS's.

I followed some online tutorial and have done these:

sudo mkdir /media/FAT32 sudo chmod 777 /media/FAT32 sudo mount /dev/sda6/ /media/FAT32

after I mounted the file, I can only read but not be able to write to it.

I checked the file permission, it becomes:

drwxr-xr-x

but after I unmounted the it then becomes

drwxrwxrwx

and I can read and write to it.

very strange.

I don't know where I've down wrong.

Cheers.

share|improve this question

migrated from stackoverflow.com Dec 7 '09 at 12:46

This question came from our site for professional and enthusiast programmers.

add comment

6 Answers

Sometimes I lost the windows disk from Linux and I solved using mount with "-o force", as this example:

sudo mount -t ntfs-3g /dev/sda1 /media/win -o force

In your case, being FAT32 you should read about, but my be this tip help. Anyway, try at your own risk!

share|improve this answer
add comment

For FAT filesystems, read/write availability is governed by the mount options.

Consult the manpage for mount and read about uid and gid mount options for FAT.

share|improve this answer
add comment

Try mounting with rw and specify the type:

mount -t vfat /dev/sda6 /media/FAT32 -o rw,uid=xxx,gid=xxx

where uid and gid are that of your user account.

share|improve this answer
    
The umask has effect when creating new files. –  geek Dec 7 '09 at 17:05
    
user and auto are options for the fstab entry; they aren't very useful on the commandline. –  quack quixote Dec 7 '09 at 19:03
    
yeah i just translated one of my fstab entries to a command line. Left in some bits that aren't useful but they aren't exactly harmful either. –  John T Dec 8 '09 at 0:02
add comment

Have you tried writing to the files with a sudo command? That should work with your current setup.

To get file writes for your normal user working, you need to use the uid and gid options to mount, to set the owner of files on the partition to your current userID. You probably also want either umask or dmask and fmask options.

Your mount command would look like this:

sudo mount -t vfat /dev/sda6 /media/FAT32 -o uid=1000,gid=1000,umask=022
# assuming your user's UID is 1000, GID is 1000
# umask=022 sets permission mode 755 for all files on the partition
share|improve this answer
add comment

You have the wrong order on the commands you want:

sudo mkdir /media/FAT32
sudo mount /dev/sda6 /media/FAT32
sudo chmod 777 /media/FAT32

What is happening is that /media/FAT32 represents different directories before and after the mount. Before it's the directory you made, and which you chmod'ed 777. After, it's the root directory of the filesystem in /dev/sda6.

share|improve this answer
add comment

If you simply forget about command line and mount with Nautilus, it should set it as you want.

From the terminal, the permissions of the folder before mounting doesn't matter. It's the mount options that count. Try:

mount -t vfat /dev/sda6 /media/FAT32 -o rw,uid=xxx,gid=xxx,umask=133,dmask=022

This will set files to rw-r--r-- and folders to rwxr-xr-x.

If you want other user/group and permissions, for instance to copy files from fat32 to the ext4 partition with the desired attributes, better consult the mount manpage. Roughly you put on umask the opposite of what you would put on chmod.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.