nm_rpi
Posts: 18
Joined: Tue May 22, 2018 6:42 am

mount f2fs usd HDD with rw permissions

Thu Sep 20, 2018 5:27 am

Finally formatted my external USB HDD to f2fs (to load the blockchain). How do i mount it so that i can read/write to it?

Code: Select all

[email protected]:~ $ sudo mount -t f2fs -o rw /dev/sda1 /mnt/usbstorage/
[email protected]:~ $ mkdir /mnt/usbstorage/.bitcoin
mkdir: cannot create directory ‘/mnt/usbstorage/.bitcoin’: Permission denied
[email protected]:~ $ 

User avatar
thagrol
Posts: 931
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: mount f2fs usd HDD with rw permissions

Thu Sep 20, 2018 11:17 am

The mount will be owned by root so you need to set permissions apropriately after mounting or change your mount options.

Try this:

Code: Select all

sudo mount -t f2fs -o rw,uid=pi.gid=pi /dev/sda1 /mnt/usbstorage/
unmount it first if already mounted or add remount to the mount options.

Alternatively, after mounting:

Code: Select all

sudo chmod a+rwx /mnt/usbstorage/
This assumes f2fs supports linux file permissionns.
Note to self: don't feed the trolls
If you believe "L'enfer, c'est les autres" (Hell is other people) have you considered that it may be of your own making?

nm_rpi
Posts: 18
Joined: Tue May 22, 2018 6:42 am

Re: mount f2fs usd HDD with rw permissions

Thu Sep 20, 2018 4:59 pm

Hello thagrol,

I got some "wrong fs type, bad option" message when i tried to pass -o param. (Again, i am guessing you had a typo when you did rw,uid=pi.gid=pi , and you meant to have a comma. Correct me if i am wrong).

Code: Select all

[email protected]:~ $ sudo mount -t f2fs -o rw,uid=pi,gid=p1 /dev/sda1 /mnt/usbstorage/
mount: wrong fs type, bad option, bad superblock on /dev/sda1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

However, doing chmod worked.

Code: Select all

[email protected]:~ $ sudo mount -t f2fs -o rw /dev/sda1 /mnt/usbstorage/
[email protected]:~ $ sudo chmod a+rwx /mnt/usbstorage/
p[email protected]:~ $ 
[email protected]:~ $ mkdir /mnt/usbstorage/.bitcoin
I was hoping to create entry in fstab and it doing an automount but looks like I will need to manually mount (and do a chmod) every-time i startup but thats ok i guess.

User avatar
thagrol
Posts: 931
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: mount f2fs usd HDD with rw permissions

Thu Sep 20, 2018 6:25 pm

nm_rpi wrote:
Thu Sep 20, 2018 4:59 pm
Hello thagrol,

I got some "wrong fs type, bad option" message when i tried to pass -o param. (Again, i am guessing you had a typo when you did rw,uid=pi.gid=pi , and you meant to have a comma. Correct me if i am wrong).

Code: Select all

[email protected]:~ $ sudo mount -t f2fs -o rw,uid=pi,gid=p1 /dev/sda1 /mnt/usbstorage/
mount: wrong fs type, bad option, bad superblock on /dev/sda1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
Yeah, that should have been a comma. Sorry
However, doing chmod worked.

Code: Select all

[email protected]:~ $ sudo mount -t f2fs -o rw /dev/sda1 /mnt/usbstorage/
[email protected]:~ $ sudo chmod a+rwx /mnt/usbstorage/
[email protected]:~ $ 
[email protected]:~ $ mkdir /mnt/usbstorage/.bitcoin
I was hoping to create entry in fstab and it doing an automount but looks like I will need to manually mount (and do a chmod) every-time i startup but thats ok i guess.
Something like this should work though I'd advise using UUID or PARTUUID instead of /dev/sda1

Code: Select all

/dev/sda1	/mnt/usbstorage	f2fs	nofail,rw,uid=pi,gid=pi	0	0
"nofail" is included so that the Pi will boot if the HDD is not connected.
Note to self: don't feed the trolls
If you believe "L'enfer, c'est les autres" (Hell is other people) have you considered that it may be of your own making?

Return to “Advanced users”