how to use USB external drives in opensuse

Well,
I think every new user coming to opensuse more first than later will need to use an external USB drive for backups, file transfers and so on.
A pretty basic feature right?
Well, since many times before I had so many problems with mounting drives in linux I wonder which are the basic and correct step to achieve that.

Please:

  1. formatting: I’m a gnome user, is gparted ok?
  2. file system: ext4, xfs or what?
    (gparte suggest ext4 by default for new partitions)
  3. if I’m going to connect the drive to the computer will my user be able to access it (read and write). To keep things simple lets say for now that the user is the same who created/formatted the volume (but I’ll probably need to know how to do when I plug in other linux boxes with other user account in it).

This is are basic things every newbie should be able to do without being a power user or at least there should be clear instructions for every major linux distribution (otherwise no point in whining about low linux share in the “market”), I hope opensuse will let me do that :slight_smile:

Many thanks in advance!

I just tried it.

  1. created new ext4 partition taking the whole 1TB drive and new MS-DOS partition table with gparted
  2. rebooted the computer
  3. for files/nautilus to show the drive I had to unplug first and replug it to the computer (even after reboot)
  4. if I transfer my docoments folder files into the drive (with Nautilus) I get an error: “permission denied”
  5. deep frustratrion
  6. wtf! :slight_smile:

Thanks for any suggestion

As root, create a subdirectory on that external drive (while mounted). Maybe give it your user name.

Then

# chown user user

That is, change the owner of that subdirectory to be you. Thereafter, you should not have problems saving into that subdirectory. If you have other users, create directories for them, too.

Thanks!
but so I won’t be able to use the gui for creating the folder and give it the right permission, right?

As to what format to use I use ext4 for hard drives that will only be seen by another Linux system and if theres a chance for a drive to be seen by a windoze system then ntfs.
I also add my usb hard drives to fstab and use the nofail,auto option so if the drive isn’t there it boots through and if it is it gets auto mounted. Also gets auto mounted if I plug it in after booting.
Just a fyi I also use UUID for all drives especially usb so that changes in order make no never mind and it just works.

These are a few things that work for me.

EDIT: for very small usb thumb drives (less than or about 64g) I use fat to format them because they will see linux and windoze systems.

for permissions I give others r w and exe for multi use drives and that works for me. I do it right from dolphin.

Gparted works well for kde also.

On Sat 16 Jan 2016 01:26:01 AM CST, horizonbrave wrote:

nrickert;2748961 Wrote:
> As root, create a subdirectory on that external drive (while
> mounted). Maybe give it your user name.
> Then >
Code:

> > # chown user user

> >
> That is, change the owner of that subdirectory to be you. Thereafter,
> you should not have problems saving into that subdirectory. If you
> have other users, create directories for them, too.

Thanks!
but so I won’t be able to use the gui for creating the folder and give
it the right permission, right?

Hi
If you really need a GUI to do this, just press alt+F2 (aka run) enter


gnomesu nautilus

It will ask for the root password, then browse through the filesystem
to the mounted device, rightclick and create a folder, then rightclick
on the folder to set permissions of user and group users.

A lot quicker through the command line :wink:


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 SP1|GNOME 3.10.4|3.12.51-60.20-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

Thanks Malcolm,
and thanks all.

It just sounded weird for me that both Gparted (or Yast Partitioner, which I just tried and choose the default suggestion of XFS for the partition) bring you to an unusable situation for a basic task such as mounting an external hd. I can’t believe such a process is not made trivial (I didn’t check what happens in Ubuntu). We’ve all this beautiful UI setting and tool with no need to touch the command line (It doesn’t scare me but I’m thinking in general)… talking about gnome and all the software included (and also advanced software like Snapper, Gimp and so on). But at the same time just mounting a usb drive (self formatted by the same user) doesn’t work.
The system tools gave an unusable mounted volume (root) which I can’t easily change or which I can’t easily create in user managable folders.

So when I get stuck there, could I please also unmount the drive and remount it with the right permission? (let’s say it’s a casual use which doesn’t require editing fstab)
Where is an opensuse howto on the matter?
Does anybody use usb drives? :slight_smile:

Sorry :slight_smile:

The permission is for the directory, not the drive and not the way of mounting.

When you mount a windows drive, linux has to simulate linux permissions. And mount options tell it which permissions to simulate. But if it “ext4”, then the permissions are all in the drive.

If you don’t want to create subdirectories, as suggested above, then you can change the owner ofd the top directory of the mounted drive.

delete please, sorry

Could that it be just a case of where to mount the drive?
Say mount it to the /home/user.:\

I have a 1TB WD My passport Ultra
and works out of the box. As soon I plug it
it is reachable by user using thunar.

It is easy you just have to know that Linux uses real permissions for files. BTW ownership is not to a name or group name but to UID and GID. ie the user ID and group ID numbers. This can cause a bit of confusion when moving files between systems

Windows files have not associated ownership in the file system it is handled by metadata.

If you make things too easy they become too insecure. Case in point Windows

Yes, the same here. But it NTFS, rather than “ext4”, and that affects permissions.

In my case the partition gets automounted by the system, isn’t it the case with your system?
I’ll try if I can see to mount it differently with the fstab option in Disk Partitioner… but I’m stubborn to see how can I manage with the default mount point (/run/media/user) and the gui tools offered by a default installation (beside trying/experimenting with manual fstab editing and chown).

Cheers!

I tried a mix of malcolmlewis’s and yours suggestion.
But haven’t been careful and changed the permission of the mounted directory (the drive one that has that horrible and long name)… is that what you mean for top directory.
Anyway it worked and everytime I plug the drive it keeps the permission. Is it a normal behaviour in your opinion? Because actually if I’m not wrong that directory shouldn’t exist when the drive is not mounted (but I may be well wrong).
Sorry I’m just trying to understand what I did.

Cheers!

I have to guess here, because I’m not sure what you did.

If your desktop is automounting the drive, then what you are seeing is normal. Yes, in that case the directory normally doesn’t exist. But I think you don’t understand mounting. So I’ll try to explain.

In order to mount a drive, you first need to create a directory (that’s called a “mountpoint” directory. Then you mount the drive on top of that directory. When the drive is mounted, you will only see the top directory of the drive. You won’t be able to see the directory underneath on which it is mounted. So when you did that “chown”, you changed the owner of the top directory of the drive.

The desktop automatically creates that mountpoint directory when you plug in the drive. And it automatically deletes it when you tell it to unmount/eject the drive. The permissions that you set are remembered in the top directory of the drive, and not in the mountpoint directory.

Here’s a hint that you might find useful. When the drive is next mount, use the “df” command to find the device name. It might be something like “/dev/sdb1”. I’ll call that “/dev/sdX1” in what follows. You have to find what is X, and check if the “1” is correct.

As root (in a terminal), you can use the command:

# e2label /dev/sdX1 MyExtDisk

That gives the disk a label. It does not have to be “MyExtDisk”. Change it to whatever you want (to a max of 16 characters).

When you next mount the disk, the mount point directory will use that label as its name, instead of that funky string of characters that you are now seeing.

On Sat 16 Jan 2016 01:26:01 AM CST, horizonbrave wrote:

nrickert;2748961 Wrote:
> As root, create a subdirectory on that external drive (while
> mounted). Maybe give it your user name.
> Then >
Code:

> > # chown user user

> >
> That is, change the owner of that subdirectory to be you. Thereafter,
> you should not have problems saving into that subdirectory. If you
> have other users, create directories for them, too.

Thanks!
but so I won’t be able to use the gui for creating the folder and give
it the right permission, right?

Hi
If you really need a GUI to do this, just press alt+F2 (aka run) enter


gnomesu nautilus

It will ask for the root password, then browse through the filesystem
to the mounted device, rightclick and create a folder, then rightclick
on the folder to set permissions of user and group users.

A lot quicker through the command line :wink:


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 SP1|GNOME 3.10.4|3.12.51-60.20-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!