I've spent a fair amount of time searching for answers but can't seem to find what I'm looking for. Hoping someone here can assist.
LM 19.1 Cinnamon
I added a second hard drive and have partitioned and formatted it. I can see it in Nemo and connect to it fine. Mounts under /Media as you would expect, but that's not what I want.
The reason for the new drive is to store my Virtualbox VMs on a separate drive instead of under /home/robert/VMs like they are now (/home and all system file are all on the same physical drive).
Can I have the /home/robert/VMs just refer to the new drive? In other words mount the drive there (moving the actual VMs to the drive first)? And NOT have the drive separately visible in Nemo? I assume Virtualbox wouldn't know or care...
Cheers,
Robert
Mount a new hard drive as a folder under home [solved]
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Mount a new hard drive as a folder under home [solved]
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Mount a new hard drive as a folder under home
I have several drives and one of these is divided to house (1) all Home backups and (2) Timeshift backups. These appear in my file system hierarchy.
If you use an external drive then you have to mount the drive every time you want to use it, whereas by having these partitions always mounted, they can be accessed instantly. For example, an executable icon on the panel will activate the backup program (grsync) and Timeshift is set to automatically run when scheduled. They do not appear in the Home folder in Nemo but are revealed under File System. If that is what you want to do then please advise.
My VirtualBox VMs are stored in a folder in my home directory but are duplicated in my home backup. VirtualBox does not appear to mind this arrangement
If you use an external drive then you have to mount the drive every time you want to use it, whereas by having these partitions always mounted, they can be accessed instantly. For example, an executable icon on the panel will activate the backup program (grsync) and Timeshift is set to automatically run when scheduled. They do not appear in the Home folder in Nemo but are revealed under File System. If that is what you want to do then please advise.
My VirtualBox VMs are stored in a folder in my home directory but are duplicated in my home backup. VirtualBox does not appear to mind this arrangement
Linux Mint 21.3 Cinnamon
Re: Mount a new hard drive as a folder under home
Yes you can, you have to edit your fstab file and add a line similar toCan I have the /home/robert/VMs just refer to the new drive?
Code: Select all
UUID=95cc8b9f-d95d-4bbb-918e-56f36856b1b6 /home/robert/VMs ext4 defaults 0 2
blkid
in a terminal.Before you do this you will need to copy the contents of
/home/robert/VMs
somewhere else, e.g. rename the folder to /home/robert/VMs-old
and then copy them back when finished. When you have made the changes to fstab you will need to reboot.It is also good practice to make a copy of fstab before you change it - if you screw up, potentially the system will not boot. fstab lives in
/etc
and has to be edited as root.Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Re: Mount a new hard drive as a folder under home
Thank you both for quality replies. I've decided that it would be no great effort for me to reinstall LM and choose to simply have my home directory located on the second drive. This is likely a best practice anyway for future OS version upgrades.
However I'm still interested in the original question and I played around a bit with it using the Disks utility that came with LM. Not entirely successfully however. A mount point was created under /home/robert/VMs but:
1) I had no access to it (may have had read, but was empty and definitely did not have write).
2) I could still see the drive (the Label anyway) listed in Nemo on the left along with USB thumb drives etc. I did choose the option in Disks to "Hide in file system" (or similar name, I'm not near the PC right now). I really don't want to see it there or necessarily at all. Seems it's being treated like removable device...
So when I undid the above, now I can no longer access the disk (read/write) when I click on it in Nemo like I could before. Weird.
On my previous LM 18 system I had a hot swap bay for a SATA drive that I would pop a drive into once in a while and back up some stuff to. I don't recall having to do anything special to access that drive, just click to mount in Nemo and run my little backup app. Granted, that is not what I was asking for in my original question, it's just odd I could do that and now I can't. Could the format of the drive make a difference? This current drive is ext4 and I believe the before I was using an NTFS drive. This one is an SSD mounted internally and the other was a spinner in the hot swap Bay (but the OS doesn't care about location or storage type does it?).
Anyway, I digress. As I say I would like to understand better.
Cheers,
Robert
However I'm still interested in the original question and I played around a bit with it using the Disks utility that came with LM. Not entirely successfully however. A mount point was created under /home/robert/VMs but:
1) I had no access to it (may have had read, but was empty and definitely did not have write).
2) I could still see the drive (the Label anyway) listed in Nemo on the left along with USB thumb drives etc. I did choose the option in Disks to "Hide in file system" (or similar name, I'm not near the PC right now). I really don't want to see it there or necessarily at all. Seems it's being treated like removable device...
So when I undid the above, now I can no longer access the disk (read/write) when I click on it in Nemo like I could before. Weird.
On my previous LM 18 system I had a hot swap bay for a SATA drive that I would pop a drive into once in a while and back up some stuff to. I don't recall having to do anything special to access that drive, just click to mount in Nemo and run my little backup app. Granted, that is not what I was asking for in my original question, it's just odd I could do that and now I can't. Could the format of the drive make a difference? This current drive is ext4 and I believe the before I was using an NTFS drive. This one is an SSD mounted internally and the other was a spinner in the hot swap Bay (but the OS doesn't care about location or storage type does it?).
Anyway, I digress. As I say I would like to understand better.
Cheers,
Robert
Re: Mount a new hard drive as a folder under home
External storage media, when plugged in, mount automatically in a default system. To have an internal drive mounted at all times you have to type the blkid of that drive into fstab as outlined by AndyMH.
There are a few further steps to take, so here is the complete sequence:
Assuming that your new drive has been formatted (e.g. ext4), first make a new directory with the command
Then (using AndyMH's example UUID as a representative guide only) enter the your new drive's UUID into /etc/fstab so that it reads like this:
UUID=95cc8b9f-d95d-4bbb-918e-56f36856b1b6 /VM ext4 defaults 0 0
Note that there is a space before /VM.
Don't forget to save your edited fstab file.
Then
Then
Then
The above commands specify you as the owner and set access permissions.
You now have a permanently mounted and accessible directory in your file system called VM.
There are a few further steps to take, so here is the complete sequence:
Assuming that your new drive has been formatted (e.g. ext4), first make a new directory with the command
sudo mkdir /VM
Then (using AndyMH's example UUID as a representative guide only) enter the your new drive's UUID into /etc/fstab so that it reads like this:
UUID=95cc8b9f-d95d-4bbb-918e-56f36856b1b6 /VM ext4 defaults 0 0
Note that there is a space before /VM.
Don't forget to save your edited fstab file.
Then
sudo mount -a
Then
sudo chown -R robert:robert /VM
Then
sudo chmod -R 755 /VM
The above commands specify you as the owner and set access permissions.
You now have a permanently mounted and accessible directory in your file system called VM.
Linux Mint 21.3 Cinnamon
Re: Mount a new hard drive as a folder under home
You can mount removable media in fstab, but it is useful to add the optionsOn my previous LM 18 system I had a hot swap bay for a SATA drive that I would pop a drive into once in a while and back up some stuff to.
nofail
- so you are not presented with a 90sec delay on boot while linux searches for a drive that isn't there, and noauto
so it doesn't automatically mount.I'm not a fan of the disks utility and don't use it. Whatever you want to do in disks you can generally do in gparted.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Re: Mount a new hard drive as a folder under home
Thank you both very much, this has been really helpful for me and I appreciate you taking the time to respond and educate me.
Cheers,
Robert
Cheers,
Robert
Re: Mount a new hard drive as a folder under home [solved]
Is creating a link at /home/robert/VMs pointing to a folder on the other disk possible?
EDIT:
The above is possible.
EDIT:
The above is possible.
- I renamed the default folder that Oracle's VirtualBox uses
VirtualBox VMs
toVirtualBox VMs ORIGINAL
- I created a folder on my mounted second drive named
VMs
- Then created a link to that folder by right-clicking on the folder
VMs
and selecting Create a Link - Renamed that link to
VirtualBox VMs
- Moved the link to my
/home/jerry
Re: Mount a new hard drive as a folder under home [solved]
Thanks Jerry, that's a good alternative option also. Appreciate you bringing this to my attention.
Cheers,
Robert
Cheers,
Robert