[SOLVED] USB drive mount point on main disk

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
JasonStonier
Level 1
Level 1
Posts: 28
Joined: Sun Oct 02, 2016 10:51 am

[SOLVED] USB drive mount point on main disk

Post by JasonStonier » Wed Apr 18, 2018 3:51 am

Firstly, apologies - this is probably a really simple question, but I can't find the answer by googling. I suspect I'm just being a bit stupid.

I have a linux mint 18 machine with a 160gig OS drive, a 1TB secondary drive, and a 2TB external USB drive.

The machine is used purely to run a virtual machine which hosts Windows Server for my small domain. The VM is on the 1TB secondary drive.

The reason for virtualising windows server is to make it easy to back up - I just copy the whole VM every week to the USB drive.

The USB drive mounts to /media/mfa/MfAServerBackup (automatically, not in fstab)

I had a problem today where linux wouldn't log in because the authorisation file couldn't be written due to the OS disk being full. I hacked around and got it to boot into a root terminal and found that the OS disk was 100% full, which I traced back to the /media/mfa/ directory on the 160gig disk, which had retained the data from the external USB disk.

Can anyone help me with why this occurred, and what I can do to prevent it? We have a lot of bad power issues here, and even with a UPS and a solar backup, this machine does sometimes get sudden power failures. Could it be an issue with this disk not being unmounted before closing linux?
Last edited by JasonStonier on Wed Apr 18, 2018 9:30 am, edited 2 times in total.

Mute Ant
Level 13
Level 13
Posts: 4894
Joined: Tue Sep 03, 2013 7:45 pm

Re: USB drive mount point on main disk

Post by Mute Ant » Wed Apr 18, 2018 5:23 am

"Can anyone help me with why this occurred..." If an auto-mount-point already exists, Mint makes a new one, so you can have several removable drives labelled 'USB-STICK' auto-mounted at the same time...
/media/mute/USB-STICK/
/media/mute/USB-STICK1/
/media/mute/USB-STICK2/
Switching off the machine without giving it a chance to auto-unmount everything leaves the mount-point folder(s) in the file system. Next auto-mount of the same volume, Mint will avoid the old name and your removable drive has 'moved'.

"...and what I can do to prevent it?" If you add the following line to your /etc/fstab file, each boot a fresh, empty RAM file system will be used for the /media folder. Any folders left-over from a dirty reset will not be seen.
tmpfs /media tmpfs nosuid,nodev 0 0
Data stored in an encrypted volume will only be accessible with the original password. Without this key, all the data will remain scrambled beyond hope of recovery.

JasonStonier
Level 1
Level 1
Posts: 28
Joined: Sun Oct 02, 2016 10:51 am

Re: USB drive mount point on main disk

Post by JasonStonier » Wed Apr 18, 2018 7:28 am

Incredibly helpful, thanks.

I did as you suggested and df now shows /media on a tempfs.

For my understanding - why do files from the USB disk end up in the filesystem on the main disk? In other words, since I presume the entire contents of the USB drive are NOT copied to the main file system every time it mounts, why did the dirty shutdowns incrementally build up 150 gig of orphaned files in /media/ ?

Mute Ant
Level 13
Level 13
Posts: 4894
Joined: Tue Sep 03, 2013 7:45 pm

Re: USB drive mount point on main disk

Post by Mute Ant » Wed Apr 18, 2018 7:48 am

[guess]
At some time there was a left-over folder from an auto-mounted drive...
/media/mfa/MfAServerBackup <----- Residue from a dirty OS reboot
...and you backed-up into it...
[/guess]
Data stored in an encrypted volume will only be accessible with the original password. Without this key, all the data will remain scrambled beyond hope of recovery.

JasonStonier
Level 1
Level 1
Posts: 28
Joined: Sun Oct 02, 2016 10:51 am

Re: USB drive mount point on main disk

Post by JasonStonier » Wed Apr 18, 2018 8:26 am

Proof that an expert's guesses are better than a fool's sure knowledge :D

That's exactly what happened - I have a cron which runs a script which backs up to /media/mfa/MfAServerBackup

Thanks for your help, really appreciate it.

Mute Ant
Level 13
Level 13
Posts: 4894
Joined: Tue Sep 03, 2013 7:45 pm

Re: [SOLVED] USB drive mount point on main disk

Post by Mute Ant » Wed Apr 18, 2018 10:20 am

"...fool's sure knowledge..." They got into print first though...https://en.wikipedia.org/wiki/Dunning%E ... ger_effect... with the exciting bonus that Dunning-Kruger sounds like something Lara Croft packs for her special weekends abroad.
Data stored in an encrypted volume will only be accessible with the original password. Without this key, all the data will remain scrambled beyond hope of recovery.

User avatar
AZgl1500
Level 7
Level 7
Posts: 1997
Joined: Thu Dec 31, 2015 3:20 am
Location: Oklahoma where the wind comes sweeping down the plains
Contact:

Re: USB drive mount point on main disk

Post by AZgl1500 » Wed Apr 18, 2018 1:19 pm

Mute Ant wrote:
Wed Apr 18, 2018 5:23 am


"...and what I can do to prevent it?" If you add the following line to your /etc/fstab file, each boot a fresh, empty RAM file system will be used for the /media folder. Any folders left-over from a dirty reset will not be seen.
tmpfs /media tmpfs nosuid,nodev 0 0
Awesome!!!

as I have to use my extUSB HDD several times a day, plug it in, unplug it, etc....

I have just entered this as a Preventive Medicine Pill

This is making me think that I now know why I have some system crashes on my old install...

One question only, does this take Immediate Effect? or do I need to reboot?

Mute Ant
Level 13
Level 13
Posts: 4894
Joined: Tue Sep 03, 2013 7:45 pm

Re: [SOLVED] USB drive mount point on main disk

Post by Mute Ant » Wed Apr 18, 2018 4:57 pm

An entry in /etc/fstab would normally be read and applied only once, during the boot sequence. If you want it to take immediate effect, you do a...
sudo mount -a
...which is a good way of checking you got the line right, too.
Data stored in an encrypted volume will only be accessible with the original password. Without this key, all the data will remain scrambled beyond hope of recovery.

User avatar
AZgl1500
Level 7
Level 7
Posts: 1997
Joined: Thu Dec 31, 2015 3:20 am
Location: Oklahoma where the wind comes sweeping down the plains
Contact:

Re: [SOLVED] USB drive mount point on main disk

Post by AZgl1500 » Wed Apr 18, 2018 5:49 pm

Thank you..... Mine is shutdown several times a day, so it does't matter now anyway.
But, that will go into my Notebook for future Reference.

Post Reply

Return to “Newbie Questions”