Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
can not read mounted usb
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Jackie Lin
Tux's lil' helper
Tux's lil' helper


Joined: 31 May 2017
Posts: 115

PostPosted: Thu Oct 11, 2018 2:15 am    Post subject: can not read mounted usb Reply with quote

hello, there. I can not read mounted usb.
/etc/fstab is below:
Code:
jerry@moonlight ~/lbdex/input $ cat /etc/fstab
# /etc/fstab: static file system information.
#
# noatime turns off atimes for increased performance (atimes normally aren't
# needed); notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.
#

# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
#
# NOTE: Even though we list ext4 as the type here, it will work with ext2/ext3
#       filesystems.  This just tells the kernel to use the ext4 driver.
#
# NOTE: You can use full paths to devices like /dev/sda3, but it is often
#       more reliable to use filesystem labels or UUIDs. See your filesystem
#       documentation for details on setting a label. To obtain the UUID, use
#       the blkid(8) command.

#LABEL=boot             /boot           ext4            noauto,noatime  1 2
#UUID=58e72203-57d1-4497-81ad-97655bd56494              /               ext4            noatime         0 1
#LABEL=swap             none            swap            sw              0 0
#/dev/cdrom             /mnt/cdrom      auto            noauto,ro       0 0
/dev/sda2               /boot           ext2            defaults,noatime        0 2
/dev/sda3               none            swap            sw                      0 0
/dev/sda4               /               ext4            noatime                 0 1

/dev/cdrom              /mnt/cdrom      auto            noauto,user             0 0
/dev/sdb1       /mnt/usb    auto        noauto,users,defaults,rw     0 0

I don't have read/write access permission after I have mounted it as an ordinary user.
Code:

jerry@moonlight ~/lbdex/input $ mount /mnt/usb
jerry@moonlight ~/lbdex/input $ ls -al /mnt
total 12
drwxr-xr-x  3 root root 4096 Oct 11 09:57 .
drwxr-xr-x 21 root root 4096 Jul  3 21:53 ..
-rw-r--r--  1 root root    0 Mar 23  2018 .keep
dr-x------  1 root root 4096 Oct 10 20:59 usb

could anyone help me? Thanks in advance!
_________________
peace, focus.
Back to top
View user's profile Send private message
Jackie Lin
Tux's lil' helper
Tux's lil' helper


Joined: 31 May 2017
Posts: 115

PostPosted: Thu Oct 11, 2018 2:35 am    Post subject: Reply with quote

After it was mounted, I tried to chmod 777.
Code:

jerry@moonlight ~/lbdex/input $ sudo chmod 777 /mnt/usb
Password:
chmod: changing permissions of '/mnt/usb': Read-only file system

I am sure it is not a read-only filesystem. The filesystem type is NTFS.
_________________
peace, focus.
Back to top
View user's profile Send private message
Ralphred
Guru
Guru


Joined: 31 Dec 2013
Posts: 470

PostPosted: Thu Oct 11, 2018 3:12 am    Post subject: Reply with quote

Try it as
Code:
/dev/sdb1    /mnt/usb    auto    defaults,noauto,user,umask=0  0 0
Back to top
View user's profile Send private message
Jackie Lin
Tux's lil' helper
Tux's lil' helper


Joined: 31 May 2017
Posts: 115

PostPosted: Thu Oct 11, 2018 3:29 am    Post subject: Reply with quote

thanks!after I changed the mount option in /etc/fstab to "noauto,defaults,user,umask=0", I have the read/exec permission.
Code:

jerry@moonlight ~/lbdex/input $ ls -al /mnt
total 12
drwxr-xr-x  3 root root 4096 Oct 11 09:57 .
drwxr-xr-x 21 root root 4096 Jul  3 21:53 ..
-rw-r--r--  1 root root    0 Mar 23  2018 .keep
dr-xr-xr-x  1 root root 4096 Oct 10 20:59 usb

_________________
peace, focus.
Back to top
View user's profile Send private message
Jackie Lin
Tux's lil' helper
Tux's lil' helper


Joined: 31 May 2017
Posts: 115

PostPosted: Thu Oct 11, 2018 3:34 am    Post subject: Reply with quote

but how can I have the write permission? I tried "noauto,defaults,user,umask=000". But it did not work.
should I set the uid option?
_________________
peace, focus.
Back to top
View user's profile Send private message
Ralphred
Guru
Guru


Joined: 31 Dec 2013
Posts: 470

PostPosted: Thu Oct 11, 2018 3:38 am    Post subject: Reply with quote

What's the output of
Code:
grep NTFS_RW /usr/src/linux/.config
Back to top
View user's profile Send private message
Jackie Lin
Tux's lil' helper
Tux's lil' helper


Joined: 31 May 2017
Posts: 115

PostPosted: Thu Oct 11, 2018 3:40 am    Post subject: Reply with quote

I tried to set the uid option. It did not work.
Code:

jerry@moonlight ~/lbdex/input $ cat /etc/fstab
# /etc/fstab: static file system information.
#
# noatime turns off atimes for increased performance (atimes normally aren't
# needed); notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.
#

# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
#
# NOTE: Even though we list ext4 as the type here, it will work with ext2/ext3
#       filesystems.  This just tells the kernel to use the ext4 driver.
#
# NOTE: You can use full paths to devices like /dev/sda3, but it is often
#       more reliable to use filesystem labels or UUIDs. See your filesystem
#       documentation for details on setting a label. To obtain the UUID, use
#       the blkid(8) command.

#LABEL=boot             /boot           ext4            noauto,noatime  1 2
#UUID=58e72203-57d1-4497-81ad-97655bd56494              /               ext4            noatime         0 1
#LABEL=swap             none            swap            sw              0 0
#/dev/cdrom             /mnt/cdrom      auto            noauto,ro       0 0
/dev/sda2               /boot           ext2            defaults,noatime        0 2
/dev/sda3               none            swap            sw                      0 0
/dev/sda4               /               ext4            noatime                 0 1

/dev/cdrom              /mnt/cdrom      auto            noauto,user             0 0
/dev/sdb1       /mnt/usb    auto        noauto,user,defaults,uid=1000,umask=000     0 0
jerry@moonlight ~/lbdex/input $ ls -al /mnt
total 12
drwxr-xr-x  3 root  root 4096 Oct 11 09:57 .
drwxr-xr-x 21 root  root 4096 Jul  3 21:53 ..
-rw-r--r--  1 root  root    0 Mar 23  2018 .keep
dr-xr-xr-x  1 jerry root 4096 Oct 10 20:59 usb

_________________
peace, focus.
Back to top
View user's profile Send private message
Jackie Lin
Tux's lil' helper
Tux's lil' helper


Joined: 31 May 2017
Posts: 115

PostPosted: Thu Oct 11, 2018 3:49 am    Post subject: Reply with quote

Code:

jerry@moonlight ~/lbdex/input $ grep NTFS_RW /usr/src/linux/.config
CONFIG_NTFS_RW=y

_________________
peace, focus.
Back to top
View user's profile Send private message
Jackie Lin
Tux's lil' helper
Tux's lil' helper


Joined: 31 May 2017
Posts: 115

PostPosted: Thu Oct 11, 2018 4:19 am    Post subject: Reply with quote

Code:

jerry@moonlight ~/lbdex/input $ cat /etc/fstab | grep sdb1
/dev/sdb1       /mnt/usb    auto        noauto,user,rw,uid=1000,gid=1000,umask=000     0 0
jerry@moonlight ~/lbdex/input $ cat /proc/mounts | grep /dev/sdb1
/dev/sdb1 /mnt/usb ntfs ro,nosuid,nodev,noexec,relatime,uid=1000,gid=1000,umask=00,nls=utf8,errors=continue,mft_zone_multiplier=1 0 0

the mount option is "ro"! how to change this?
_________________
peace, focus.
Back to top
View user's profile Send private message
Ralphred
Guru
Guru


Joined: 31 Dec 2013
Posts: 470

PostPosted: Thu Oct 11, 2018 6:37 am    Post subject: Reply with quote

It comes from the "defaults" probably, though ro isn't a recognised option of the ntfs fstab entry, it is of mount.
Try it as
Code:
/dev/sdb1       /mnt/usb    auto        noauto,user,defaults,rw,umask=0


If it still doesn't work, comment out the fstab entry and mount it as root with -o [list of different options] until it's working, then just copy the missing bits from the line in /etc/mtab to complete your /etc/fstab entry.
/etc/mtab might also give some insight as to what options are being set by "default" that are not well documented under the ntfs section of man mount.
Back to top
View user's profile Send private message
Jackie Lin
Tux's lil' helper
Tux's lil' helper


Joined: 31 May 2017
Posts: 115

PostPosted: Thu Oct 11, 2018 7:26 am    Post subject: Reply with quote

I tried. It doesn't work.
Code:

moonlight /home/jerry/lbdex/input # mount -o rw,defaults,user,umask=0  /dev/sdb1 /mnt/usb
moonlight /home/jerry/lbdex/input # ls -al /mnt
total 12
drwxr-xr-x  3 root root 4096 Oct 11 09:57 .
drwxr-xr-x 21 root root 4096 Jul  3 21:53 ..
-rw-r--r--  1 root root    0 Mar 23  2018 .keep
dr-xr-xr-x  1 root root 4096 Oct 10 09:46 usb

It is wierd, could anynone help me ?
_________________
peace, focus.
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1869
Location: Switzerland (Romandie)

PostPosted: Fri Mar 08, 2019 1:01 am    Post subject: Reply with quote

I use autofs and pmount for the removable medias.
_________________
"Confirm You are a robot." - the singularity
Back to top
View user's profile Send private message
i4dnf
Apprentice
Apprentice


Joined: 18 Sep 2005
Posts: 271
Location: Bucharest, Romania

PostPosted: Fri Mar 08, 2019 7:49 am    Post subject: Reply with quote

For proper ntfs read/write you need the sys-fs/ntfs3g package. The in-kernel ntfs is very limited. I would suggest you even disable it.
Once you emerge ntfs3g you can mount it as:
Code:

/dev/sdb1   /mnt/usb      ntfs-3g      auto,nls=utf8,locale=en_US.utf8,umask=0,silent,big_writes,nonempty,nofail   0 0

although I would suggest to mount it by UUID. First you need to get the UUID with:
Code:

blkid /dev/sdb1

then you put the UUID in fstab, instead of the device path:
Code:

UUID="$theUUIDfromblkid"   /mnt/usb      ntfs-3g      auto,nls=utf8,locale=en_US.utf8,umask=0,silent,big_writes,nonempty,nofail   0 0


If the kernel NTFS support is disabled, you could rely on the automounter, but it might set mount options differently.
_________________
"The only difference between me and a madman is that I am not MAD" (SALVATOR DALI)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum