Why is mounting a USB disk in a usable manner so difficult?

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Why is mounting a USB disk in a usable manner so difficult?

Jeff Lane-2
TSIA.

I have a brand new 2TB USB3 external HDD.  It came from the factory
formatted in NTFS, naturally.

I also have a system running Saucy.

I plug my brand new 2TB NTFS formatted external USB3 HDD into my
system running Saucy and the drive is mounted to my user mount dir
with 0700 permissions:

drwx------ 1 bladernr bladernr 4096 Dec 16 12:47 Alexandria

and anything created inside that drive is given 0600 permissions:
-rw------- 1 bladernr bladernr 179 Dec 16 12:47 update-library

and it is absolutely IMPOSSIBLE to create an executable script on that
disk.  Utterly impossible.  Even after trying to remount with the
right fmask, umask and dmask.  Even after trying to remount with exec
set.

So I gave up on NTFS and formatted the drive in ext4.  After
re-formatting in ext4, I plugged the 2TB external USB3 HDD into my
Saucy machine.

NOW, Saucy chooses to mount the drive in my users mount point,
/media/username/drivename
WITH ROOT ownership.
/dev/sdb1 on /media/bladernr/Alexandria type ext4
(rw,nosuid,nodev,uhelper=udisks2)

bladernr@klaatu:/media/bladernr$ ll
total 4
drwxr-xr-x 3 root root 4096 Dec 16 13:21 Alexandria

Which makes it impossible toe ven create files on my USB HDD now.

so two questions:

How the heck do I fix this so that my external hard drives are mounted
in a way that I can actually use them?

Why do we make it so bloody difficult to actually plug a drive in and use it?

Cheers,

Jeff

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Why is mounting a USB disk in a usable manner so difficult?

Johnny Rosenberg
2013/12/16 J <[hidden email]>
TSIA.

I have a brand new 2TB USB3 external HDD.  It came from the factory
formatted in NTFS, naturally.

I also have a system running Saucy.

I plug my brand new 2TB NTFS formatted external USB3 HDD into my
system running Saucy and the drive is mounted to my user mount dir
with 0700 permissions:

drwx------ 1 bladernr bladernr 4096 Dec 16 12:47 Alexandria

and anything created inside that drive is given 0600 permissions:
-rw------- 1 bladernr bladernr 179 Dec 16 12:47 update-library

and it is absolutely IMPOSSIBLE to create an executable script on that
disk.  Utterly impossible.  Even after trying to remount with the
right fmask, umask and dmask.  Even after trying to remount with exec
set.

So I gave up on NTFS and formatted the drive in ext4.  After
re-formatting in ext4, I plugged the 2TB external USB3 HDD into my
Saucy machine.

NOW, Saucy chooses to mount the drive in my users mount point,
/media/username/drivename
WITH ROOT ownership.
/dev/sdb1 on /media/bladernr/Alexandria type ext4
(rw,nosuid,nodev,uhelper=udisks2)

bladernr@klaatu:/media/bladernr$ ll
total 4
drwxr-xr-x 3 root root 4096 Dec 16 13:21 Alexandria

Which makes it impossible toe ven create files on my USB HDD now.

so two questions:

How the heck do I fix this so that my external hard drives are mounted
in a way that I can actually use them?

Why do we make it so bloody difficult to actually plug a drive in and use it?

I don't know why that happens, it doesn't happen to me. I just plug mine in and it's ready to be used.
Anyway, can't you just change the owner with ”sudo chown bladernr:bladernr /media/bladernr/Alexandria”?


Johnny Rosenberg
 

Cheers,

Jeff

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Why is mounting a USB disk in a usable manner so difficult?

Nils Kassube-2
Johnny Rosenberg wrote:

> 2013/12/16 J <[hidden email]>
> > NOW, Saucy chooses to mount the drive in my users mount point,
> > /media/username/drivename
> > WITH ROOT ownership.
> > /dev/sdb1 on /media/bladernr/Alexandria type ext4
> > (rw,nosuid,nodev,uhelper=udisks2)
> >
> > bladernr@klaatu:/media/bladernr$ ll
> > total 4
> > drwxr-xr-x 3 root root 4096 Dec 16 13:21 Alexandria
> >
> > Which makes it impossible toe ven create files on my USB HDD now.
> >
> > so two questions:
> >
> > How the heck do I fix this so that my external hard drives are
> > mounted in a way that I can actually use them?
> >
> > Why do we make it so bloody difficult to actually plug a drive in
> > and use it?
>
> I don't know why that happens, it doesn't happen to me. I just plug
> mine in and it's ready to be used.
> Anyway, can't you just change the owner with ”sudo chown
> bladernr:bladernr /media/bladernr/Alexandria”?

Indeed that should work. And as it is a disk meant to be used for data
only, it is probably useful to make the entire space available. Normally
5% of the space is reserved for root. Use the command

sudo tune2fs -m 0 /dev/sdb1

if the disk is still at "/dev/sdb". Otherwise replace the "/dev/sdb1"
with the appropriate device.


Nils


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Why is mounting a USB disk in a usable manner so difficult?

Liam Proven
In reply to this post by Jeff Lane-2
On 16 December 2013 18:45, J <[hidden email]> wrote:
>
> How the heck do I fix this so that my external hard drives are mounted
> in a way that I can actually use them?
>
> Why do we make it so bloody difficult to actually plug a drive in and use it?

It *is* difficult, I agree. Sadly, the flipside of Unix' better
security than Windows is that sometimes it gets in the way.

To mount my drives permanently, I recently discovered a handy file
called /etc/mtab

It's a counterpart to /etc/fstab which is the one that describes where
stuff *should be* mounted. The mtab file describes where it *is
currently* mounted.

I have spent ages trying to write /etc/fstab lines that will allow me
to mount my own drives and have RW access to them without using
superuser powers -- the way they're mounted if I connect them when the
system is already running. I never got it right.

But what I found that I could do was:

* insert the drive
* make a note of where Ubuntu mounted it
* copy the line from /etc/mtab describing that mount
* paste it into /etc/fstab
* unmount / eject the drive
* manually create the mount point

Shut down, connect drive, reboot, & the drive was then automatically
mounted in the right place, with the right permissions.

*Far* easier than trying to work out the right parameters and switches
for fstab, which I have been fighting since about 1989.

Also, note that the drive might end up belonging to the user who
formatted it. Try formatting it from the Disks program, or right from
the Launcher, and then you should be the owner.

--
Liam Proven • Profile: http://lproven.livejournal.com/profile
Email: [hidden email] • GMail/G+/Twitter/Flickr/Facebook: lproven
MSN: [hidden email] • Skype/AIM/Yahoo/LinkedIn: liamproven
Tel: +44 20-8685-0498 • Cell: +44 7939-087884

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Why is mounting a USB disk in a usable manner so difficult?

Jeff Lane-2
In reply to this post by Johnny Rosenberg
On Mon, Dec 16, 2013 at 2:25 PM, Johnny Rosenberg
<[hidden email]> wrote:
> 2013/12/16 J <[hidden email]>

>> NOW, Saucy chooses to mount the drive in my users mount point,
>> /media/username/drivename
>> WITH ROOT ownership.
>> /dev/sdb1 on /media/bladernr/Alexandria type ext4
>> (rw,nosuid,nodev,uhelper=udisks2)
>>
>> bladernr@klaatu:/media/bladernr$ ll
>> total 4
>> drwxr-xr-x 3 root root 4096 Dec 16 13:21 Alexandria
>>
>> Which makes it impossible toe ven create files on my USB HDD now.
>>
>> so two questions:
>>
>> How the heck do I fix this so that my external hard drives are mounted
>> in a way that I can actually use them?
>>
>> Why do we make it so bloody difficult to actually plug a drive in and use
>> it?
>
>
> I don't know why that happens, it doesn't happen to me. I just plug mine in
> and it's ready to be used.
> Anyway, can't you just change the owner with ”sudo chown bladernr:bladernr
> /media/bladernr/Alexandria”?


Yeah, I can, but that's really a temporary fix, I think... at least in
the since that I think I will run into the same issue every time I use
the drive on a different machine, once I set it permanently on my
primary system.  So I either have to fix udev on every system I want
to use the drive on, or I have to take that extra step every time I
plug the drive in...  the real problem is that it's just ridiculous
that when I plug my drive in, it's unusable without me monkeying about
in a terminal.

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Why is mounting a USB disk in a usable manner so difficult?

Jeff Lane-2
In reply to this post by Liam Proven
On Mon, Dec 16, 2013 at 3:04 PM, Liam Proven <[hidden email]> wrote:

> On 16 December 2013 18:45, J <[hidden email]> wrote:
>>
>> How the heck do I fix this so that my external hard drives are mounted
>> in a way that I can actually use them?
>>
>> Why do we make it so bloody difficult to actually plug a drive in and use it?
>
> It *is* difficult, I agree. Sadly, the flipside of Unix' better
> security than Windows is that sometimes it gets in the way.
>
> To mount my drives permanently, I recently discovered a handy file
> called /etc/mtab
>
> It's a counterpart to /etc/fstab which is the one that describes where
> stuff *should be* mounted. The mtab file describes where it *is
> currently* mounted.
>
> I have spent ages trying to write /etc/fstab lines that will allow me
> to mount my own drives and have RW access to them without using
> superuser powers -- the way they're mounted if I connect them when the
> system is already running. I never got it right.
>
> But what I found that I could do was:
>
> * insert the drive
> * make a note of where Ubuntu mounted it
> * copy the line from /etc/mtab describing that mount
> * paste it into /etc/fstab
> * unmount / eject the drive
> * manually create the mount point
>
> Shut down, connect drive, reboot, & the drive was then automatically
> mounted in the right place, with the right permissions.
>
> *Far* easier than trying to work out the right parameters and switches
> for fstab, which I have been fighting since about 1989.
>
> Also, note that the drive might end up belonging to the user who
> formatted it. Try formatting it from the Disks program, or right from
> the Launcher, and then you should be the owner.

Yep... you can do it a couple ways, actually.  If you have the UUID or
disklabel you can add that to fstab using uuid= or label= like so:
UUID=e7eedf5d-5aad-4230-b123-47162b1acea6 /media/disk1
ext4    errors=remount-ro 0       0
LABEL=mydrive  /data   ext4  noauto 0 0

or you can set it somewhere in udev rules, but tweaking udev rules is
not necessarily trivial.

Still doesn't get around the point that the behaviour is different for
the same device.  Leaving the whole setting executable permissions
aside, why does the drive mount as my user when formatted in NTFS but
root only when formatted in EXT4?

Sigh...  Oh well.

>
> --
> Liam Proven • Profile: http://lproven.livejournal.com/profile
> Email: [hidden email] • GMail/G+/Twitter/Flickr/Facebook: lproven
> MSN: [hidden email] • Skype/AIM/Yahoo/LinkedIn: liamproven
> Tel: +44 20-8685-0498 • Cell: +44 7939-087884
>
> --
> ubuntu-users mailing list
> [hidden email]
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Why is mounting a USB disk in a usable manner so difficult?

Nils Kassube-2
In reply to this post by Jeff Lane-2
J wrote:

> On Mon, Dec 16, 2013 at 2:25 PM, Johnny Rosenberg
> <[hidden email]> wrote:
> > 2013/12/16 J <[hidden email]>
> >> How the heck do I fix this so that my external hard drives are
> >> mounted in a way that I can actually use them?
> >>
> >> Why do we make it so bloody difficult to actually plug a drive in
> >> and use it?
> >
> > I don't know why that happens, it doesn't happen to me. I just plug
> > mine in and it's ready to be used.
> > Anyway, can't you just change the owner with ”sudo chown
> > bladernr:bladernr /media/bladernr/Alexandria”?
>
> Yeah, I can, but that's really a temporary fix, I think... at least in
> the since that I think I will run into the same issue every time I
> use the drive on a different machine, once I set it permanently on my
> primary system.

The fix is permanent for the drive, but it may not work on other
machines as expected. The owner is actually not "bladernr" but "1000"
(if your UID is "1000" like it is for the first user created on the
Ubuntu system). The files on the disk may be owned by me, if you plug
your drive into my machine. I don't think there is an easy way to make
it work like the usual USB stick which is fromatted with FAT32.


Nils


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Why is mounting a USB disk in a usable manner so difficult?

Liam Proven
On 16 December 2013 20:44, Nils Kassube <[hidden email]> wrote:
>
> The fix is permanent for the drive, but it may not work on other
> machines as expected. The owner is actually not "bladernr" but "1000"
> (if your UID is "1000" like it is for the first user created on the
> Ubuntu system). The files on the disk may be owned by me, if you plug
> your drive into my machine. I don't think there is an easy way to make
> it work like the usual USB stick which is fromatted with FAT32


Agreed -- I was going to post more or less the same explanation.


--
Liam Proven • Profile: http://lproven.livejournal.com/profile
Email: [hidden email] • GMail/G+/Twitter/Flickr/Facebook: lproven
MSN: [hidden email] • Skype/AIM/Yahoo/LinkedIn: liamproven
Tel: +44 20-8685-0498 • Cell: +44 7939-087884

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Why is mounting a USB disk in a usable manner so difficult?

Florian Diesch
In reply to this post by Johnny Rosenberg
Am Mon, 16 Dec 2013 20:25:11 +0100
schrieb Johnny Rosenberg <[hidden email]>:

> I don't know why that happens, it doesn't happen to me. I just plug
> mine in and it's ready to be used.

If a file system supports unix style file permission (like ext4) they
are used as if you mount the disk and you can change them by using chmod
and chown but not by mount options.

If a file system doesn't support unix style file permission (like NTFS)
permissions are emulated and you can change them by mount options but
not by using chmod and chown.



--
Privacy Indicator
Unity appindicator to switch privacy settings
<http://www.florian-diesch.de/software/indicator-privacy/>

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Why is mounting a USB disk in a usable manner so difficult?

William Scott Lockwood III-2

On Dec 16, 2013 11:27 PM, "Florian Diesch" <[hidden email]> wrote:
> If a file system doesn't support unix style file permission (like NTFS)
> permissions are emulated and you can change them by mount options but
> not by using chmod and chown.

I think you meant to sat FAT/FAT32. NTFS works adequately under Linux, and is mostly just missing file system tools.


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Why is mounting a USB disk in a usable manner so difficult?

Rashkae-2
On 13-12-17 07:22 AM, William Scott Lockwood III wrote:
> On Dec 16, 2013 11:27 PM, "Florian Diesch" <[hidden email]> wrote:
>> If a file system doesn't support unix style file permission (like NTFS)
>> permissions are emulated and you can change them by mount options but
>> not by using chmod and chown.
> I think you meant to sat FAT/FAT32. NTFS works adequately under Linux, and
> is mostly just missing file system tools.
>
>
>
No, He meant NTFS.  No matter how well NTFS works in Linux, it does not
support Unix permissions, and in that regard, is handled the same as
FAT.  (And while you can use NTFS for compatability with Windows, I
think you have a very loose definition of adequately.  Suffice to say, I
would not suggest using NTFS *unless* either the filesystem is primarily
for use by Windows, or Windows compatability is required as well as
large file (or more exotic file names) support.

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Why is mounting a USB disk in a usable manner so difficult?

William Scott Lockwood III-2
On Tue, Dec 17, 2013 at 12:46 PM, Rashkae <[hidden email]> wrote:
> No, He meant NTFS.  No matter how well NTFS works in Linux, it does not
> support Unix permissions, and in that regard, is handled the same as FAT.
> (And while you can use NTFS for compatability with Windows, I think you have
> a very loose definition of adequately.  Suffice to say, I would not suggest
> using NTFS *unless* either the filesystem is primarily for use by Windows,
> or Windows compatability is required as well as large file (or more exotic
> file names) support.


Ok, here's an experiment to try. Create some files. Make sure they
have different attributes, such as owner, group, perms, etc. Now copy
them to an NTFS partition. Now copy them back to the original machine
in a different location. Now compare them.

--
W. Scott Lockwood III
AMST Tech (SPI)
GWB2009033817
http://www.shadowplayinternational.org/
"There are four boxes to be used in defense of liberty:  soap, ballot,
jury, and ammo. Please use in that order." -Ed Howdershelt (Author)

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users