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
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.
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
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.