You are not logged in.

#1 2014-09-30 22:50:14

necbot
Member
Registered: 2013-12-05
Posts: 59

Cannot write to automounted ext4 formated USB flash drive

I have mate as my desktop and when I plug in a USB drive it automatically mounts it to /run/media/<username>  The problem is that I cannot write to the USB drive if the drive is ext4 formated.  However, I can write to it if it's fat32 formated.  Is there a setting I'm missing?

Offline

#2 2014-09-30 22:50:54

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Cannot write to automounted ext4 formated USB flash drive

Seems you're missing permissions. It's ext4. Adjust them however you want with the standard chown/chgrp/chmod tools...

Offline

#3 2014-09-30 23:56:19

necbot
Member
Registered: 2013-12-05
Posts: 59

Re: Cannot write to automounted ext4 formated USB flash drive

I did what you suggested and changed ownership using the following command...

sudo chown -R necbot:users  /run/media/necbot/8GB

This works, but every time I remove the drive and plug it back in the ownership get's reset back to root and I cannot write.  How do I set the automount settings so that it mounts it as read write?  Is there a way to do this so I don't have to reset the ownership every time?

Last edited by necbot (2014-09-30 23:57:25)

Offline

#4 2014-10-01 09:04:24

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,302

Re: Cannot write to automounted ext4 formated USB flash drive

You could create as root under the volatile mount point, a working directory with your owner/group read/write permissions:

# cd /run/media/necbot/8GB
# mkdir necbot
# chown necbot:users necbot

Then you will have read/write access to /run/media/necbot/8GB/necbot, without the need to change the volatile mount point ownership.

Offline

#5 2014-10-02 00:51:38

necbot
Member
Registered: 2013-12-05
Posts: 59

Re: Cannot write to automounted ext4 formated USB flash drive

This works but it's inconvenient because every time I use a different USB drive, I have to set permissions manually.  I'd rather have write permission assigned automatically.  Is there a way to do this?

Offline

#6 2014-10-02 08:06:14

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,302

Re: Cannot write to automounted ext4 formated USB flash drive

Sorry I have only that to propose; of course you need to create a working directory on each USB disk you are using; but that creation is only done once.
I agree that may not be convenient if you already have files on your disks; you will have to move these files to the working directory, but after that everything should be easier: you only work inside the working directory.

To obtain what you want, it is necessary to act at the udev level, or use some other tools to mount your external disks; the wiki has infos about a few of them.

Offline

#7 2014-10-02 10:43:14

mauritiusdadd
Member
From: Benevento, Italy
Registered: 2013-10-27
Posts: 776

Re: Cannot write to automounted ext4 formated USB flash drive

If you want to automatically set permissions when a storage device is plugged in, you can try devmon. It can be found in the community/udevil package. Once you have installed it, edit the file /etc/conf.d/devmon according to your needs (I assume you have gksu installed on your system since mate is a GNOME based DE):

For example, if you want to change the ownership of the mount point, replace the ARGS variable with:

ARGS="--exec-on-drive 'gksu \"chown necbot %d\"'"

or if you want to add only the write permission:

ARGS="--exec-on-drive 'gksu \"chmod +w %d\"'"

After that, as root enable and start the devmon service:

systemctl enable devmon@necbot.service
systemctl start devmon@necbot.service

Now, when you insert a storage device you will be prompted to enter the root password: if you provide the password then the permissions/ownership of the mout mpoint will be changed otherwise the mount point will be left untouched.


About me - github

-- When you have eliminated the impossible, whatever remains, however improbable, must be the truth -- Spock | Sherlock Holmes

Offline

#8 2014-10-02 12:39:52

mrunion
Member
From: Jonesborough, TN
Registered: 2007-01-26
Posts: 1,938
Website

Re: Cannot write to automounted ext4 formated USB flash drive

@necbot, why not just format your USB drives with FAT32? It's kinda universal for that purpose,and eliminates the problem you are having. Is there a reason the flash drives have to be ext4?


Matt

"It is very difficult to educate the educated."

Offline

#9 2014-10-02 18:52:53

paulkerry
Member
From: Sheffield, UK
Registered: 2014-10-02
Posts: 611

Re: Cannot write to automounted ext4 formated USB flash drive

How about fully opening the permissions for the entire drive? For example, as root when the drive is mounted...

chmod 777 /run/media/necbot

Offline

#10 2014-10-02 19:44:51

nstgc
Member
Registered: 2014-03-17
Posts: 393

Re: Cannot write to automounted ext4 formated USB flash drive

mrunion wrote:

@necbot, why not just format your USB drives with FAT32? It's kinda universal for that purpose,and eliminates the problem you are having. Is there a reason the flash drives have to be ext4?

I can't speak for the topic creator, but something like ext4 would result in longer life for the drive. I myself have mine formated with btrfs, that is even easier on nand drives.

Offline

Board footer

Powered by FluxBB