1

I'm formatting an USB pen drive. For this I run the following commands:

First umount the device:
sudo umount /run/media/myuser/folder_where_is_mounted (I'm runing manjaro and is in /run where devices are connected)

Second Format the pen drive:
sudo mkfs.vfat -I /dev/sdc (sdc is the device I want to format)

Third I create a folder for use as mountpoint:
sudo mkdir -p /run/media/myuser/turid

After that I have set permissions and owner: sudo chown myuser:myuser /run/media/myuser/turid && sudo chmod -R 777 /run/media/myuser/turid

And finally I mount the device: sudo mount /dev/sdc /run/media/myuser/turid

And when I try to copy in file manager a file I get the message "Permission denied" even when the owner is myuser and I have rights to create and remove.

I have noticed that when I unplug and plug again it creates a new folder (as normal) and mounts the device with the same permissions and I can copy (as is normal and right). So anyone can help me to explain this?

2
  • have you tried to set owner and group and permission after mount the filesystem ?
    – Archemar
    Dec 24, 2015 at 14:22
  • @Archemar It says that is not a valid operation. I think that it is because is already mounted, but don't know, just a guess Dec 24, 2015 at 15:30

1 Answer 1

2

a. You aren't partitioning your usb. You need to identify sdc1 not sdc.

b. You don't normally need to create a static mount point for a usb and you shouldn't have to mess with permissions in there. Just partition and format properly and then unplug and plug back in.

c. You should never create mount points within /run it's for dynamic mounting only.

d. You don't need to name the mount point to umount, you can name the device, much shorter.

So:

  1. sudo fdisk -l # to make sure you have the correct device
  2. sudo umount /dev/sdc1 #assuming the device still has the name you've given above.
  3. sudo mkfs.vfat -n 'device name' -I /dev/sdc1 to format the entire device

Then either pull it out and plug it back in so it automounts or, if you must have a static mount point:

  1. sudo mkdir /mnt/usbstick # or whatever name you want for the mount point
  2. sudo blkid /dev/sdc1 # to obtain uuid, copy this to the buffer
  3. add this to your fstab (using vifs): UUID=E8F1-5438 /mnt/usbstick vfat user,noauto,noatime,flush 0 0 #where UUID=E8F1-5438 is just an example.

It will then auto allow mounting to your static mount point and allow normal users to write to it. You will still need to mount it if you don't want to pull it out and plug it in at least once. If you want it to automount to that mount point you will need to change noauto to auto.

There's really no reason to use steps 4-5 unless you are booting from this device or something else that requires that it always be in the same place.

See https://wiki.archlinux.org/index.php/USB_storage_devices and http://en.proft.me/2015/08/25/how-format-usb-arch-linuxubuntu-command-line/ for more examples. Manjaro is downstream from arch, as I'm sure you know.

1
  • BTW, if you do steps 4-6, it may still automount to /run/media, it doesn't matter much, it can be mounted two places at once, but you may need to umount it twice before removing it again. If you want to disable automounting to /run/media, that's set by part of your desktop environment (DE). I don't use a DE so I can't help you there. Dec 24, 2015 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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