Mount settings for external drive that wont always be connected to the computer

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Netherprovinc3
Level 4
Level 4
Posts: 456
Joined: Mon Feb 04, 2019 9:29 pm

Mount settings for external drive that wont always be connected to the computer

Post by Netherprovinc3 »

I am trying to follow a tutorial that explains how to create a mount point for a second drive to be mounted at the time of boot and have the owner and group be the user account (not root).

Here is the tutorial (not necessary for you to view to understand my post)
https://www.youtube.com/watch?v=JS0Jd_DNXdg

I used this tutorial for a second internal drive that I wanted to be mounted every time at boot. The tutorial worked well. However, I am not sure if the instructions are going to be applicable here because now I am dealing with an external drive that will only sometimes be connected to my computer.

I would think that the first few steps in the tutorial are applicable.

Code: Select all

sudo cd /media/Netherprovinc3
sudo mkdir ExtBkupDrv3
sudo chown Netherprovinc3:Netherprovinc3 ExtBkupDrv3/
But, is it still appropriate to edit fstab with a line like this?

Code: Select all

UUID=f4f4c-7079-4900-94fa-baci164c5fa7	/media/Netherprovinc3/USBDrive3  ext4    defaults    0   0
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 3 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Mount settings for external drive

Post by rene »

No, having that in fstab would cause the boot to hang when the drive's not connected. However, the automounter (i.e., that which mounts filesystems upon connecting an e.g. USB-drive) has the useful behaviour of grabbing mountpoints and options from fstab as well if the filesystem is named there, so you should only keep it from mounting at boot by changing "defaults" to "noauto". Run systemctl daemon-reload or reboot after changing /etc/fstab.

Note of course that ext4 is a proper UNIX-filesystem with full support for per-file/directory ownership which then also means you need to set said ownership correctly if you want access as your user. I.e., after mounting the filesystem on here /media/<you>/USBDrive3, if you'd want any and all on that filesystem owned by you, you say sudo chown -R $(whoami): /media/$(whoami)/USBDrive3 once.
Netherprovinc3
Level 4
Level 4
Posts: 456
Joined: Mon Feb 04, 2019 9:29 pm

Re: Mount settings for external drive

Post by Netherprovinc3 »

rene wrote: Thu Jun 24, 2021 7:35 pm ...so you should only keep it from mounting at boot by changing "defaults" to "noauto". Run systemctl daemon-reload or reboot after changing /etc/fstab.

Note of course that ext4 is a proper UNIX-filesystem with full support for per-file/directory ownership which then also means you need to set said ownership correctly if you want access as your user. I.e., after mounting the filesystem on here /media/<you>/USBDrive3, if you'd want any and all on that filesystem owned by you, you say sudo chown -R $(whoami): /media/$(whoami)/USBDrive3 once.
In my post, I put some commands in to create a directory (shown as step 1 below). Is that still a proper step? I am guessing the drawback is that that directory will show there even when the drive is not connected.

Step 1

Code: Select all

sudo cd /media/Netherprovinc3
sudo mkdir ExtBkupDrv3
sudo chown Netherprovinc3:Netherprovinc3 ExtBkupDrv3/
I saw a post in another forum where the answer had
sudo mkdir -p /media/Netherprovinc3/ExtBkupDrv3
As I understand, -p will make the parent directory, if needed. Maybe useful if you are not logged in as the user that you are creating the directory for? It also wont show any error message if that directory already exists.

Step 2
Format the drive or create the partition. The drive is brand new, out of the box right now.

Step 3
Get UUID of drive

Step 4

Code: Select all

sudo nano /etc/fstab
add this to the end of the text file & save

Code: Select all

UUID=f4f4c-7079-4900-94fa-baci164c5fa7	/media/Netherprovinc3/USBDrive3  ext4    noauto    0   0
Not much of a difference between having a 0 vs 2 at the end there? Here is some info on that. https://www.redhat.com/sysadmin/etc-fstab
The You Tuber that I linked to puts 0. Even though the You Tuber is knowledgeable, Red Hat might be a more reliable source.

step 5
mount the drive at the mount point of the folder created in step 1

step 6
sudo chown -R $(whoami): /media/$(whoami)/USBDrive3

Also, somewhere in the process (not sure where), I need to run

Code: Select all

systemctl daemon-reload
I am glad that I am learning this using the command line as the programs with GUIs might handle the drive in a way that is not preferred. I have had that experience with other drives. Those still might be set up the wrong way. Also, developers could change how the GUI does it. Bash (or whatever I'm using) I think is not as likely to change.
User avatar
AndyMH
Level 21
Level 21
Posts: 13743
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Mount settings for external drive that wont always be connected to the computer

Post by AndyMH »

Step 2
Format the drive or create the partition. The drive is brand new, out of the box right now.

Step 3
Get UUID of drive
If a brand new bare drive, it will need a partition table before you create any partitions.

Amend your fstab entry to:

Code: Select all

UUID=f4f4c-7079-4900-94fa-baci164c5fa7	/media/Netherprovinc3/USBDrive3  ext4    defaults,noauto,nofail    0   0
You need to run

Code: Select all

systemctl daemon-reload
after you have plugged the drive in. An alternative would be

Code: Select all

sudo mount -a
which tells linux to reread fstab.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Mount settings for external drive

Post by rene »

Netherprovinc3 wrote: Thu Jun 24, 2021 9:24 pm In my post, I put some commands in to create a directory (shown as step 1 below). Is that still a proper step? I am guessing the drawback is that that directory will show there even when the drive is not connected.
Yes, it is proper. On Linux a filesystem is mounted on "a mountpoint" and latter is nothing other than a directory; the mount will need said directory to exist to be able to use it as the mountpoint.
Netherprovinc3 wrote: Thu Jun 24, 2021 9:24 pm Step 1
[ ... ]
I saw a post in another forum where the answer had
sudo mkdir -p /media/Netherprovinc3/ExtBkupDrv3
As I understand, -p will make the parent directory, if needed. Maybe useful if you are not logged in as the user that you are creating the directory for?
First of all; usernames on Linux are all-lowercase so I will assume you said "netherprovinc3" wherever you in fact said "Netherprovinc3". Other than that...

Yes, and it's a reason I personally stay out of /media and mount under /mnt instead. In a practical sense you may feel free to fully ignore this because things work either way but in theory the directory /media/netherprovinc3 might only exist with you in fact logged in. On Ubuntu/Mint it exists after you've logged in at least once --- or logged in at least once and inserted a removable drive --- so things work, but that "or"-clause there already says this to be the kind of thing I feel one should not depend on; it's likely not even standardised. As such I consider /media the private playground of the automounter and myself mount under /mnt alone. I.e., I would here use

Code: Select all

sudo mkdir /mnt/ExtBkupDrv3
Once again, feel free to ignore this part if you like it under /media/netherprovinc3. Works fine.
Netherprovinc3 wrote: Thu Jun 24, 2021 9:24 pm Step 2
Format the drive or create the partition. The drive is brand new, out of the box right now.
As Andy said, a fully empty drive you'd need to partition first (normally giving it one large partition spanning the entire drive) but a brand new drive undoubtedly comes prepartitioned and preformatted to NTFS. In that case you'd only reformat to ext4 the existing partition.
Netherprovinc3 wrote: Thu Jun 24, 2021 9:24 pm Step 3
Get UUID of drive
Well, yes, although it should be noted that it's not the UUID of the drive but of the filesystem that you just created in step 2. Important in the sense of you needing to expect this UUID to change if you later reformat it.

One other thing that is of interest here is that rather than by UUID you may also elect to label the filesystem and mount it by that. By UUID works fine but some prefer by label. I.e., after or during step 2 you'd give the filesystem a label through whichever tool you use for the formatting, or after say e.g.

Code: Select all

sudo e2label /dev/sdz1 ExtBkupDrv3
with the in your case proper partition identifier /dev/sdz1. See next step for the difference if you do this.
Netherprovinc3 wrote: Thu Jun 24, 2021 9:24 pm Step 4

Code: Select all

sudo nano /etc/fstab
add this to the end of the text file & save

Code: Select all

UUID=f4f4c-7079-4900-94fa-baci164c5fa7	/media/Netherprovinc3/USBDrive3  ext4    noauto    0   0
Here you've used /media/Netherprovinc3/USBDrive3 as the mountpoint whereas above you are creating it as /media/Netherprovinc3/ExtBkupDrv3 but I'll assume that's just a copy/paste thing; you of course want the same directory here as in step 1.

Andy advises to change "noauto" to "defaults,noauto,nofail" but that's not in fact necessary. "defaults" exists basically only for when you do in fact want the defaults but still need something to put in fstab at that spot. It means "rw,suid,dev,exec,auto,nouser,async" and all of these are in fact, well, defaults for ext4. You in this case do not want all of those defaults; in fact want "noauto" instead of "auto". Might as well not say you do then either. "nofail" moreover makes no sense really for a "noauto" filesystem.

Which is again not to say that not just either way works in practice...

The "0 0" is fine and in fact something you can leave out entirely since no numbers there is equivalent to "0 0" anyway. First of these numbers was at one time used by a now obsolete backup tool, second determines boot-time filesystem-check order, but since you are due to "noauto" not mounting at boot it's also fully ignored. I personally leave out both numbers for anything other than my permanently mounted "system filesystems".

As to the UUID: if you in the previous step elected to label the filesystem you can here also say e.g.

Code: Select all

LABEL=ExtBkupDrv3	/media/netherprovinc3/ExtBkupDrv3	ext4	noauto
or

Code: Select all

LABEL=ExtBkupDrv3	/mnt/ExtBkupDrv3	ext4	noauto
if you elected to use /mnt instead. Potentially somewhat neater than through the long filesystem-UUID; makes no difference otherwise.
Netherprovinc3 wrote: Thu Jun 24, 2021 9:24 pm step 5
mount the drive at the mount point of the folder created in step 1
Sure, manually, or through here using the suggested sudo systemctl daemon-reload followed by ejecting-inserting the drive; this should then have it automount on the just in fstab set mountpoint.
Netherprovinc3 wrote: Thu Jun 24, 2021 9:24 pm step 6
sudo chown -R $(whoami): /media/$(whoami)/USBDrive3
Again the USBDrive3 vs. ExtBkupDrv3 thing but other than that: yes. The point is that you are going to need to re-own the root directory of the just created filesystem to yourself to be able to as yourself create anything in it. On a just created filesystem it's actually better to leave out the -R to keep the standard lost+found directory root-owned --- although it again makes not a whiff of practical difference. But then,

Code: Select all

sudo chown netherprovinc3: /media/netherprovinc3/ExtBkupDrv3
or, again,

Code: Select all

sudo chown netherprovinc3: /mnt/ExtBkupDrv3
if you placed it there instead. Note that the previously suggested $(whoami) just inserts the output of the command whoami which if you try it is your username, i.e., no difference between that and saying "netherprovinc3" if latter is in fact your username.
Netherprovinc3 wrote: Thu Jun 24, 2021 9:24 pm I am glad that I am learning this using the command line as the programs with GUIs might handle the drive in a way that is not preferred.
Was as verbose as all this due to this remark but please don't mistake verbosity for this in fact being difficult; as indicated at a few points above most of the details do not in fact matter; were here explained just to be thorough. Hope it helps.
Netherprovinc3
Level 4
Level 4
Posts: 456
Joined: Mon Feb 04, 2019 9:29 pm

Re: Mount settings for external drive

Post by Netherprovinc3 »

rene wrote: Fri Jun 25, 2021 9:10 am Yes, and it's a reason I personally stay out of /media and mount under /mnt instead. In a practical sense you may feel free to fully ignore this because things work either way but in theory the directory /media/netherprovinc3 might only exist with you in fact logged in. On Ubuntu/Mint it exists after you've logged in at least once --- or logged in at least once and inserted a removable drive --- so things work, but that "or"-clause there already says this to be the kind of thing I feel one should not depend on; it's likely not even standardised. As such I consider /media the private playground of the automounter and myself mount under /mnt alone. I.e., I would here use
Your post is very helpful.
I like the idea of using /mnt for my drives. Among other things, it seems useful that we are separating our work from the work that the auto mounter & other preinstalled utilites (gparted, disks) might do. That could help in troubleshooting. In other words, we can more clearly see what's going on in the GUI.

I am still struggling a bit with creating the ext4 partition. I think I will jump over to the GUI for that as other approaches might complicate things for me. I am not sure whether to use disks or gparted. I don't think it will matter once we are finished with all of the steps?

One thing that I am still unclear about is about the long term implication of creating the mount point. In other words, are we now relying on different steps in order to mount the drive? It seems there is a way to disable that auto mounter but I don't think I am quite read for that as I am still trying to get comfortable with what we are doing here and I want other external drives that sometimes get attached to the computer to still work.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Mount settings for external drive that wont always be connected to the computer

Post by rene »

Netherprovinc3 wrote: Mon Jun 28, 2021 3:49 pm I am still struggling a bit with creating the ext4 partition. I think I will jump over to the GUI for that as other approaches might complicate things for me.
As long as you know the partition device that Linux has upon connecting the drive assigned to the partition you aim to format it's in fact very simple from the command line. I.e., that partition device is going to be something like /dev/sdc1 or /dev/sdd2; not currently at a Linux system to quickly check but undoubtedly Disks or gparted prominently displays it somewhere. Using /dev/sdz9 as the placeholder for it, formatting is a simple matter of

Code: Select all

mkfs -t ext4 /dev/sdz9
as mentioned potentially followed by e2label /dev/sdz9 "TheLabel" if you liked that LABEL= mounting method better than the UUID= one.

But sure; formatting from Disks or gparted is fine (and will supposedly allow you to specify any potentially desired label immediately).
Netherprovinc3 wrote: Mon Jun 28, 2021 3:49 pm One thing that I am still unclear about is about the long term implication of creating the mount point. In other words, are we now relying on different steps in order to mount the drive?
No, creating the mountpoint is a one-time step. It's as said nothing other than a directory, and as any normal directory simply lives on. Morerover, do note that you are setting this up to still use the automounter as such: naming the filesystem in /etc/fstab just has said automounter grab the mountpoint and/or options from there rather than using (only) some to it built-in ones.

Allow me to give you the condensed version of this; the "$" and "#" signs are prompt signs:

Code: Select all

$ sudo -s
# mkfs -t ext4 /dev/sdz9
# e2label /dev/sdz9 ExtBkUpDrv3 
# eject /dev/sdz
# mkdir /mnt/ExtBkupDrv3
# echo "LABEL=ExtBkupDrv3 /mnt/ExtBkupDrv3 ext4 defaults" >>/etc/fstab (NOTE double >>; single would overwrite)
# systemctl daemon-reload
# exit
$
After dis- and reconnecting the drive, it should automount on /mnt/ExtBkupDrv3 (which is to say you should see a lost+found folder there). Do

Code: Select all

$ sudo chown $(whoami): /mnt/ExtBkupDrv3
The drive should then be fully ready to be written to / read from from under /mnt/ExtBkupDrv3, and including after you remove/reinsert it again: you won't have to do anything special furthermore.

Of course, if any of those steps give an error you'd have to deal with that (save the eject step; it's normal to have it note that it can't actually eject the drive in a hardware sense; it'll still remove it in a software one) but generally they won't. Do of course be sure to use the correct device "sdz9" lest you'd be formatting something unintended.
Netherprovinc3
Level 4
Level 4
Posts: 456
Joined: Mon Feb 04, 2019 9:29 pm

Re: Mount settings for external drive that wont always be connected to the computer

Post by Netherprovinc3 »

I used gparted because I was getting overwhelmed by too many command line steps.
Something seems to have gone wrong.
When I do

Code: Select all

systemctl daemon-reload
the drive doesn't mount. It is not there when I look at the ejectable devices (system tray in Nemo).

after adding the line to fstab, I think there is one "enter" keystroke. Is that good?

maybe I was supposed to set the permissions on the drive before mounting it? I think gparted sets chown to root:root?

Key thing here: don't reboot computer at this point otherwise it wont boot.

Edit:
When I change fstab back to what is was originally, I then see the drive in the left hand tree of Nemo.
I then clicked on it and it mounted in
/media/netherprovinc3/
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Mount settings for external drive that wont always be connected to the computer

Post by rene »

You as mentioned need to dis- and reconnect the drive after the systemctl daemon-reload; it should then automount on the /etc/fstab location.

Yes, the graphical manager's display of things is basically a list of /media/<you>; after mounting the drive on e.g. /mnt/ExtBkupDrv3 it's a simple part of the file system; not "external"as such. I basically never use a graphical file manager; if you insist on its behaviour place it on /mnt/<you>/ExtBkupDrv3 after all.

As to the "key thing"; sorry about that. As basically the entire gist of this thread I mentioned originally that you need "noauto"rather than "defaults" but then in the "condensed version" said "defaults" anyway. I.e., make that "noauto".

No, when unmounted the directory /mnt/ExtBkupDrv3 "should" preferably be owned by root; it's after it mounts that that directory takes on the permissions of the on it mounted directory, i.e., the root directory of your just created filesystem, and that should be user-owned lest you would not be allowed to create anything in it; made you do the chown after it mounted for a reason, that is.

If you are going to place it under /media/<you> after all it makes a bit more sense to also have the mountpoint user-owned; you'd in that case need to run the chown both before and after mounting the filesystem.

And as the theme of this thread is: does not in fact matter in the end. Only thing is that "noauto" instead of "defaults" thing, and if mounted under /mnt just browsing to /mnt/ExtBkupDrv3 (possibly through a bookmark if you care for it) like you would to any other location. Or, as said, have it under /media/<you> after all if you're used/wed to the filemanager ways.
Netherprovinc3
Level 4
Level 4
Posts: 456
Joined: Mon Feb 04, 2019 9:29 pm

Re: Mount settings for external drive that wont always be connected to the computer

Post by Netherprovinc3 »

rene wrote: Mon Jun 28, 2021 11:39 pm You as mentioned need to dis- and reconnect the drive after the systemctl daemon-reload; it should then automount on the /etc/fstab location.
You are right. I forgot that part. But, still, the drive doesn't show in /mnt/ unless there is nothing to see. I don't even see the trash/recycling. From what I can tell in the GUI, the folder is owned by the user and the group is the user. However, maybe the contents of the folder are not because there is a button to do that.
Permissions on the folder.png
rene wrote: Mon Jun 28, 2021 11:39 pm Yes, the graphical manager's display of things is basically a list of /media/<you>; after mounting the drive on e.g. /mnt/ExtBkupDrv3 it's a simple part of the file system; not "external"as such. I basically never use a graphical file manager; if you insist on its behaviour place it on /mnt/<you>/ExtBkupDrv3 after all.
I will have to live without the gui, then. I will have to review how to unmount without that.
rene wrote: Mon Jun 28, 2021 11:39 pm As to the "key thing"; sorry about that. As basically the entire gist of this thread I mentioned originally that you need "noauto"rather than "defaults" but then in the "condensed version" said "defaults" anyway. I.e., make that "noauto".
Ok so with "noauto" it will boot even in the (possibly) non-working state that I am in now.
Netherprovinc3
Level 4
Level 4
Posts: 456
Joined: Mon Feb 04, 2019 9:29 pm

Re: Mount settings for external drive that wont always be connected to the computer

Post by Netherprovinc3 »

The permissions that show on my folder in /mnt are not the permissions that show on a working mount folder in /media. The folder itself in /media is owned by root, and the group is root. But, the contents in the folder seems to be user1:user1.

The situation that I am in really doesn't make sense
I ran the commands

Code: Select all

sudo mkdir ExtBkupDrive3
sudo chown silver2:silver2 ExtBkupDrive3/
The resulting permissions are the opposite of what those commands should have produced.

I feel like I am super accident prone in Linux. Maybe I'm just cursed.
Netherprovinc3
Level 4
Level 4
Posts: 456
Joined: Mon Feb 04, 2019 9:29 pm

Re: Mount settings for external drive that wont always be connected to the computer

Post by Netherprovinc3 »

If worse comes to worse and I have to use /media and not have a pre-designated folder, at least the folder only creates itself when the drive is plugged in. This way if you have several drives that you plug in (but have only 1 or 2 connected at one time), you can quickly find the drive and the access the files on it.

I wish there was a way to simplify permissions. Maybe run a command periodically to clarify all the permissions. For example, change the permissions for /home to always be my user account and not root. Have this apply to all future folders created in those directories. I mean maybe just have everything be the user account and spend the saved time dealing with other stuff such as your router. Does root even solve a high percentage of intrusions? An Minix based intrusion lol's at root.
gittiest personITW
Level 12
Level 12
Posts: 4285
Joined: Tue May 28, 2019 4:27 pm

Re: Mount settings for external drive that wont always be connected to the computer

Post by gittiest personITW »

Try adding the -R (recursive)

Code: Select all

sudo chown -R silver2:silver2 ExtBkupDrive3/
User avatar
AndyMH
Level 21
Level 21
Posts: 13743
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Mount settings for external drive that wont always be connected to the computer

Post by AndyMH »

gittiest personITW wrote: Tue Jun 29, 2021 4:14 am Try adding the -R (recursive)

Code: Select all

sudo chown -R silver2:silver2 ExtBkupDrive3/
That won't work, you haven't specified the full pathname, if /mnt is being used it should be /mnt/ExtBkupDrive3, same for the mkdir command.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
gittiest personITW
Level 12
Level 12
Posts: 4285
Joined: Tue May 28, 2019 4:27 pm

Re: Mount settings for external drive that wont always be connected to the computer

Post by gittiest personITW »

Yes, of course.

Cheers Andy.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Mount settings for external drive that wont always be connected to the computer

Post by rene »

The -R was moreover as mentioned above not specified on purpose due to wanting to keep the lost+found folder root-owned.

Netherprovinc3: I'm afraid this is starting to not make sense and the current state of things is due to the back & forths and seeing things reported without full steps or here full path unclear. I will suppose the partition has been formatted as an ext4 filesystem by now.

1. sudo mkdir -p /mnt/ExtBkupDrv3
2. Make sure that a line like

Code: Select all

LABEL=ExtBkupDrv3 /mnt/ExtBkupDrv3 ext4 noauto
is present in /etc/fstab --> and if you have labelled the filesystem as advised <--

3. If you just now added said line, sudo systemctl daemon-reload.
4. Reconnect the drive; its contents should appear in /mnt/ExtBkupDrv3; said contents are for a just ext4-formatted drive a folder "lost+found" alone.
5. sudo chown $(whoami): /mnt/ExtBkupDrv3
6. Done; anything going to resp. coming from /mnt/ExtBkupDrv3 goes to resp. comes from your drive.

[EDIT] If you decide to have the automounter do it all automatically under /media/<you>/ instead, you do not need anything in /etc/fstab nor need to create /directories manually. In that case just, with the drive mounted, sudo chown $(whoami): /media/$(whoami)/<mountpoint> for whatever <mountpoint> the automounter used; normally also the filesystem label or UUID.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Mount settings for external drive that wont always be connected to the computer

Post by rene »

Note; reviewing the thread, it seems you should be ignoring any and all except my above [EDIT]; thread started giving you specific answers to specifically posed questions then saw me being oh-so-helpful expanding on each and any in a general context but if you as per OP are only after the non-permanently connected drive being accessible to you as your user, the only thing that should happen is the chowning of the filesystem's root-directory.

I.e., with the drive mounted, sudo chown $(whoami): /media/$(whoami)/<mountpoint> or the same through some graphical means you prefer.
Netherprovinc3
Level 4
Level 4
Posts: 456
Joined: Mon Feb 04, 2019 9:29 pm

Re: Mount settings for external drive that wont always be connected to the computer

Post by Netherprovinc3 »

I think I have learned a lot from this thread (I really mean this). For example, I have a general understanding of the order of steps in setting up a new drive on my computer to mount it at a location of my choosing with the permissions that I want.

I think it's good in a way that I didn't get the result I wanted. Sometimes you have to live with not achieving the end result that you were originally looking for. You then reevaluate and set new goals.

I do have another drive that I might set up on this computer that will also be a temporarily connected drive (for example, connected 1 week per month). So maybe I can give this all another try with that drive.

For now, I think I will have the goal of correctly setting up the drive using the GUI, with minimal command line steps. I have connected several drives to my computer and used them. But, I am not so sure that I have ever done one in a truely correct format.

For the new goal, your command is good. (I modified it a little because I think I saw mention of a bug with $USER or some similar command. Perhaps that issue is even outdated by now. I'd imagine yours is ok, though)

Code: Select all

sudo chown silver2:silver2 /media/silver2/ExtBkupDrv3 
I think that the folder itself has the correct permissions but between the last post of mine yesterday and this post today I put some content on the drive and that seems to be owned by root, with group root. This is because I was running incremental backup as root which I now understand is not a good thing. Here is my post that relates a little bit to that
viewtopic.php?f=47&t=351922

Also, I didn't use LABEL=ExtBkupDrv3 because I don't want the overhead of making sure that I don't use that label again. Instead I used the long string of letters and numbers.

I think I will start with erasing what's on the drive. I am not sure if I should do that using Back In Time or whether I should navigate to the folder in Nemo and delete it.

Thank you for all of your help. I assure you the lessons are not falling on deaf ears, only very clumsy limbs, I guess you would say.
User avatar
AndyMH
Level 21
Level 21
Posts: 13743
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Mount settings for external drive that wont always be connected to the computer

Post by AndyMH »

Code: Select all

sudo chown silver2:silver2 /media/silver2/ExtBkupDrv3 
is exactly the same as

Code: Select all

sudo chown $USER:$USER /media/silver2/ExtBkupDrv3 
USER is an environment variable that holds your username. echo $USER in a terminal to see. The $ symbol means 'the contents of'. $(whoami) is another way of getting at your username.
Also, I didn't use LABEL=ExtBkupDrv3 because I don't want the overhead of making sure that I don't use that label again. Instead I used the long string of letters and numbers.
Good! It is relatively easy to change the label on a partition, more difficult (and thus less prone to error) to use the UUID (which is what the long string of numbers is).
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Locked

Return to “Other topics”