[Solved] Creating Extra Root ( / ) Partition

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
User avatar
pbear
Level 10
Level 10
Posts: 3383
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Creating Extra Root ( / ) Partition

Post by pbear »

Dumfy wrote:
Mon Feb 10, 2020 7:28 am
It looks like sdb is being used by generic mass storage.
I've only run into something like that once and I've never been able to fix it. In my case, a weirdly formatted USB drive convinced the BIOS of my Win7 vintage laptop that it needed a scsi emulator. Now BIOS loads one every time I boot (also when I come out of suspend) and it gets assigned sdb. I can close the device from Disks (which frees up the slot), but can't access the BIOS setting to stop it from being loaded in the first place (that setting isn't in the standard user-accessible screens). Reflashing the BIOS didn't help either.

Anyhoo, I don't know whether you have something like that, but it looks mighty similar.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

User avatar
pbear
Level 10
Level 10
Posts: 3383
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Creating Extra Root ( / ) Partition

Post by pbear »

There are many ways to mount a data partition at boot, of which this is perhaps the simplest. It produces only a single entry in the home folder, for the data partition itself, but that’s fine for this scenario. Don't be intimidated by the length of the instructions. Doesn't take long to do.

0. Before doing anything, make sure you have a current Timeshift snapshot, just in case.

1. Open File Manager. Create a folder in home to which we will mount the data partition. Call it just VirtualBox.

2. Create partition. Open GParted. Select appropriate device from drop-down at upper-right. Right-click sdc1; select Move/Resize; using the slider, create as much space as you want to give the new VBox partition.* Click the check mark to Apply the change. Resizing a large partition takes a long time (an hour to two),** as lots of files have to be reconfigured to “move” them to the left (it's kind of like a defrag in Windows), so find something else to do in the meantime. Once complete, click Partition on Menu and select New. By default, the app will assume you want to give the new partition all the available space, which in this case you do. Tab to Format (or select with mouse) and select NTFS from drop-down. Tab to Label and enter VirtualBox.*** Hit Apply again. Unlike resize, this will run very quickly.

* For reference, I generally give test box VMs a virtual hard drive of 40 GB. So, a 500 GB partition would have room for ten VMs, leaving enough free space for a reasonable buffer. If you want to use one (or more) of the VMs to do stuff, that might require a larger virtual hard drive and reduce the number of VMs a partition of a given size can accommodate. FYI, partition sizes are specified in MiB in GParted. For example, 500 GiB = 512,000 MiB (500 x 1024).

** This issue only arises when shrinking or moving a partition. Resize to the right without moving (enlarging the partition) takes very little time. By the way, all these operations require the partition to be unmounted, so sometimes you need to do this stuff from a live session.

*** There’s an advantage in Linux to avoiding spaces in label names, as spaces mean something functional in Terminal and have to be “quoted” to be read as spaces. So, if you want to call the partition VirtualBox VMs, use a hyphen or underscore, VirtualBox-VMs or VirtualBox_VMs. I use plain VirtualBox; not like it’s ambiguous.


3. Edit fstab to mount the partition at boot. First, make a copy: sudo cp /etc/fstab /etc/fstab-old. Now open the file with administrative privileges. I prefer to use nano (a simple terminal text editor), but you also can use xed (the default GUI text editor). For the former, run sudo nano /etc/fstab; for the latter, run xed admin:///etc/fstab. Enter password when prompted (which will happen twice for the second option). Go to the end of the file and hit Enter twice to get a new line. Insert the following (use copy-and-paste):

Code: Select all

# Mount VirtualBox partition into Home folder
LABEL=VirtualBox   /home/bfg/VirtualBox   ntfs-3g   defaults,windows_names,locale=en_US.utf8  0  0
If using nano, click Ctrl-O to write-out, Enter to overwrite current file, and Ctrl-X to exit and return to Terminal. . If using xed, click Ctrl-S to save, then Ctrl-X to exit; you’ll see an error message about location not mounted; it’s a bug, harmless and can be ignored.

Note: The partition being mounted can be identified by label or UUID; I use the former here, but the latter might be more suitable in other situations. Also, be aware the paramters for an ext4 partition would be very different. You can read more about fstab at Ubuntu Help. Even more useful, albeit very technical, is the man page (manual) for the mount command, which is what actually uses the parameters set in fstab. See also this tutorial for how to set up more complex data partitions than we're doing here.

4. Confirm. Still in Terminal, run sudo mount -a. If no error is reported, you should be good. If there's an error, restore fstab and report back. So, rename the edited fstab file (sudo mv etc/fstab /etc/fstab-new) and restore the old one (sudo mv /etc/fstab-old /etc/fstab). Then post here the contents of the edited file, cat /etc/fstab-new, so we can figure out what went sideways.

[Edited to add sudo to the move/rename commands.]

5. When you install VirtualBox, it will create a separate folder in home called VirtualBox VMs (with a space, dammit). Open File > Preferences > Default Machine Folder. Change that to the VirtualBox folder we set up. Open File Manager and delete the folder VBox created. Now all VM files will end up in the data partition and, so, can be shared by both operating systems.

FYI, something I forgot to mention when we first started down this path. The one annoying quirk about sharing VMs between Windows and Linux is that the shared folder settings will be incompatible. Shared folders are what you use to give the VM access to files on the computer. So, if you use shared folders (and you probably will), you’re gonna get a warning every time you boot a VM and there’s no way I’ve found to turn that off. OTOH, the VM will run fine, including the shared folder for the OS acting as host (the other OS’s shared folder won’t work, of course), so the warning is merely an annoyance.

That should do it. Apologies for any typos or omissions. I know this works, as I’ve done it, but it’s always difficult to proofread one’s own text.
Last edited by pbear on Tue Feb 25, 2020 1:13 am, edited 2 times in total.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

Dumfy
Level 2
Level 2
Posts: 52
Joined: Thu Oct 15, 2015 8:35 am

Re: Creating Extra Root ( / ) Partition

Post by Dumfy »

pbear wrote:
Mon Feb 10, 2020 9:00 pm
Dumfy wrote:
Mon Feb 10, 2020 7:28 am
It looks like sdb is being used by generic mass storage.
I've only run into something like that once and I've never been able to fix it. In my case, a weirdly formatted USB drive convinced the BIOS of my Win7 vintage laptop that it needed a scsi emulator. Now BIOS loads one every time I boot (also when I come out of suspend) and it gets assigned sdb. I can close the device from Disks (which frees up the slot), but can't access the BIOS setting to stop it from being loaded in the first place (that setting isn't in the standard user-accessible screens). Reflashing the BIOS didn't help either.

Anyhoo, I don't know whether you have something like that, but it looks mighty similar.


It is strange and only applies to Linux. No reference to that drive at all in WIndows Disk Management or MiniTool Partition Manager - everything looks normal

Dumfy
Level 2
Level 2
Posts: 52
Joined: Thu Oct 15, 2015 8:35 am

Re: Creating Extra Root ( / ) Partition

Post by Dumfy »

pbear wrote:
Mon Feb 10, 2020 9:27 pm
There are many ways to mount a data partition at boot, of which this is perhaps the simplest. It produces only a single entry in the home folder, for the data partition itself, but that’s fine for this scenario. Don't be intimidated by the length of the instructions. Doesn't take long to do.
Thank you so much for taking the time to write this walk through for me pbear. It really is appreciated.
Need to study it now and then lock myself away in a quiet room while I go through it. I'll be sure to let you know of my progress.

One quick question if you don't mind . . . Does the procedure set the whole drive to auto mount, or just the VB partition? The reason I ask is that all my music, photos etc are on that drive and it would be convenient to able to point Banshee/Rhythmbox to it as my music source.

User avatar
pbear
Level 10
Level 10
Posts: 3383
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Creating Extra Root ( / ) Partition

Post by pbear »

Dumfy wrote:
Tue Feb 11, 2020 11:33 am
Does the procedure set the whole drive to auto mount, or just the VB partition? The reason I ask is that all my music, photos etc are on that drive and it would be convenient to able to point Banshee/Rhythmbox to it as my music source.
It mounts only the partition.

If you want everything to mount, you can do one of three things. One would be to make VirtualBox a folder of the existing partition, then mount User Profile in fstab. substituting LABEL="User Profile" for LABEL=VirtualBox. You can direct VBox to that folder just as easily as any other. Second, you could split the drive as above and mount both partitions separately. Third, you could mount User Profile to /mnt (without splitting it) and use symlinks from folders on the partition into your home folder. That's the procedure described in the tutorial I linked above. It's more work to set up, but more elegant once done. FWIW, I've done all three and option one is what I'm doing now, i.e., one big data partition without symlinks.

As for your phantom drive, I mostly mentioned my experience in case you find yourself having trouble when you reattach the backup drive.
If not, there's probably nothing else going on worth worrying about.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

Dumfy
Level 2
Level 2
Posts: 52
Joined: Thu Oct 15, 2015 8:35 am

Re: Creating Extra Root ( / ) Partition

Post by Dumfy »

Thanks pbear, but having asked my last question, I've got myself confused (not difficult!)

I wish I'd thought of this earlier, but it would be great for me to be able to have the whole drive, sdc, to auto mount at boot. That way I can access my music and files more easily.
Will I still need to create an extra partition on the drive for VirtualBox use, or can I just use some of the remaining space for VB as is?

User avatar
pbear
Level 10
Level 10
Posts: 3383
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Creating Extra Root ( / ) Partition

Post by pbear »

That's option one in my preceding post. Maybe it will help if I phrase it parallel to the walk through:

0. Timeshift snapshot (don't skip this).

1. Create new folder in Home called User Profile.

2. [Skip, new plan is one partition only.]

3. Edit fstab as described above, except (i) replace LABEL=VirtualBox with LABEL="User Profile" and (ii) modify mount point from /home/bfg/VirtualBox to /home/bfg/"User Profile".

4. Confirm. [Same as above.]

5. VirtualBox. I think this is where I lost you. At installation, VBox will create a folder in home called VirtualBox VMs. You need to move the VM folder into User Profile, so the files get saved on the data partition. Then edit VBox Preferences to reflect the change.

Does that make it clear?
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

Dumfy
Level 2
Level 2
Posts: 52
Joined: Thu Oct 15, 2015 8:35 am

Re: Creating Extra Root ( / ) Partition

Post by Dumfy »

Thanks pbear. That makes it a lot clearer for me. My request to make the whole drive mount seems to have made the process easier, but the I'm going to save the whole procudure you provided as it's valuable.

I've given it a few attempts, but have come up against a couple of problems - sorry. What I've had to do is paste below the info from Terminal and also the contents of the edited FSTAB file. I hope they are of use for finding where I went wrong . . .

FROM TERMINAL

Code: Select all

bfg@bfg-maindesktop:~$ sudo cp /etc/fstab /etc/fstab-old
[sudo] password for bfg:           
bfg@bfg-maindesktop:~$ xed admin:///etc/fstab

** (xed:2811): WARNING **: 12:31:59.894: The specified location is not mounted
bfg@bfg-maindesktop:~$ sudo mount -a
mount: /etc/fstab: parse error at line 15 -- ignored
bfg@bfg-maindesktop:~$ mv etc/fstab /etc/fstab-new
mv: cannot stat 'etc/fstab': No such file or directory
bfg@bfg-maindesktop:~$ mv /etc/fstab-old /etc/fstab
mv: replace '/etc/fstab', overriding mode 0644 (rw-r--r--)? y
mv: cannot move '/etc/fstab-old' to '/etc/fstab': Permission denied
bfg@bfg-maindesktop:~$ cat /etc/fstab-new
cat: /etc/fstab-new: No such file or directory
bfg@bfg-maindesktop:~$
EDITED FSTAB FILE:

Code: Select all

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/nvme0n1p5 during installation
UUID=1a71f8ef-48c4-4539-a53a-fb1f37c283cf /               ext4    errors=remount-ro 0       1
# /home was on /dev/nvme0n1p7 during installation
UUID=84824d3c-d493-4790-b440-171a4d1a8ca4 /home           ext4    defaults        0       2
# swap was on /dev/nvme0n1p6 during installation
UUID=5f5d6506-1dc9-4e90-abad-a6ae0b5b2d75 none            swap    sw              0       0
# Mount VirtualBox partition into Home folder
LABEL="User Profile"   /home/bfg/"User Profile"   ntfs-3g   defaults,windows_names,locale=en_US.utf8  0  0
What I've since is gone into /etc as Root,
deleted newly created FSTAB file,
renamed FSTAB_OLD to FSTAB.
System boots and runs correctly

User avatar
pbear
Level 10
Level 10
Posts: 3383
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Creating Extra Root ( / ) Partition

Post by pbear »

First, my bad about the mv commands not working. (FYI, in Linux, move in the same folder = rename.) Careless oversight on my part. I forgot to prefix the commands with sudo. I'm going to edit the instructions, but you did what I said originally.

By the way, if you run into a similar problem in future, resist the urge to go into the system as root-the-user. You can do a lot of damage that way. Try sudo instead. If that doesn't work, figure out the problem and/or go back to the source for clarification. If all else fails, use Timeshift.

Question remains of why the revised fstab wouldn't mount User Profile. Darned if I can spot an error, yours or mine.* Let's make sure the mount point is right. Boot Mint, open Terminal and run ls -l (those are "L's"). This will list all the sub-directories in Home and their permissions.

* One small point, not substantive. When you redo this, for clarity, replace VirtualBox in the the comment line (the one beginning with #) with User Profile.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

Dumfy
Level 2
Level 2
Posts: 52
Joined: Thu Oct 15, 2015 8:35 am

Re: Creating Extra Root ( / ) Partition

Post by Dumfy »

pbear wrote:
Thu Feb 13, 2020 1:04 pm
First, my bad about the mv commands not working. (FYI, in Linux, move in the same folder = rename.) Careless oversight on my part.
Not a problem at all. I'm only too glad of your assistance.
pbear wrote:
Thu Feb 13, 2020 1:04 pm
By the way, if you run into a similar problem in future, resist the urge to go into the system as root-the-user
Point well made & understood - thanks. I'm not sure if there's a difference, but I didn't use root through the terminal (not even sure if you can). I opened /etc as root to sort out the FSTAB files. I guess the end result is possible system damage tho'

Have run ls -l and pasted the output from terminal below . . .

Code: Select all

bfg@bfg-maindesktop:~$ ls -l
total 44
drwxrwxr-x  2 bfg bfg 4096 Jan 26 00:01  Audiobooks
drwxr-xr-x  3 bfg bfg 4096 Feb 10 00:40  Desktop
drwxr-xr-x  7 bfg bfg 4096 Feb 13 12:51  Documents
drwxr-xr-x  4 bfg bfg 4096 Feb 13 11:20  Downloads
drwxr-xr-x 18 bfg bfg 4096 Feb  9 12:49  Music
drwxr-xr-x  3 bfg bfg 4096 Feb 10 11:18  Pictures
drwxrwxr-x  2 bfg bfg 4096 Jan 26 00:01  Podcasts
drwxr-xr-x  2 bfg bfg 4096 Jan 13 16:32  Public
drwxr-xr-x  2 bfg bfg 4096 Jan 13 16:32  Templates
drwxrwxr-x  2 bfg bfg 4096 Feb 13 11:43 'User Profile'
drwxr-xr-x  2 bfg bfg 4096 Feb 13 11:29  Videos
bfg@bfg-maindesktop:~$ 

User avatar
pbear
Level 10
Level 10
Posts: 3383
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Creating Extra Root ( / ) Partition

Post by pbear »

Dumfy wrote:
Fri Feb 14, 2020 7:25 am
I'm not sure if there's a difference, but I didn't use root through the terminal (not even sure if you can). I opened /etc as root to sort out the FSTAB files.
It is different, and in a good way. I assume what you mean is that you opened File Manager as Administrator. If so, that's a good answer. Comes with a caution, though. Only keep an administrative session of a GUI app open long enough to do the specific task for which you opened it, then close it. Also, since we're on the topic, never use sudo to open a GUI app. For File Manager, I assume you used the right-click option, which is fine. For the correct procedure when that's not available (most cases, actually), see ELTP.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

User avatar
pbear
Level 10
Level 10
Posts: 3383
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Creating Extra Root ( / ) Partition

Post by pbear »

Now, back to the main topic.

Code: Select all

bfg@bfg-maindesktop:~$ ls -l
drwxrwxr-x  2 bfg bfg 4096 Feb 13 11:43 'User Profile'
That looks right. Now let's try mounting the partition manually.

Code: Select all

sudo mount LABEL="User Profile" /home/bfg/"User Profile"
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

User avatar
pbear
Level 10
Level 10
Posts: 3383
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Creating Extra Root ( / ) Partition

Post by pbear »

As it happens, I set up a full install USB drive last night for another thread, so I decided to test your problem on it. It's a 64 GB flash drive. I shrunk the system partition (which is ext4, of course) and created a new ntfs partition called User Profile. Modified fstab per my instructions. Sure enough, I get the parse error. Curiously, manual mount (the test in my last post) works fine. Darned if I can figure out the discrepancy. I'll probably find the answer eventually, but if you just want to get this working, I've tested and confirmed an alternate solution.

First, you need to get rid of the space in the mount point, i.e., the folder in Home. (Told you those can be a problem.) You can use a hyphen or an underscore. In this case, I think underscore looks better, so User_Profile. Easiest to change the folder name in File Manager.

Then, open fstab (xed admin:///etc/fstab) and change the last line to this:

Code: Select all

UUID=01D4F6118430BAD0   /home/bfg/User_Profile   ntfs-3g   defaults,windows_names,locale=en_US.utf8  0  0
The UUID, by the way, comes from your earlier blkid output. This isn't a elegant as the original solution, but it works. If you would rather use a hyphen than an underscore, that'll work fine also. Just be sure the mount point and the fstab entry match.

------------

ETA: Found it. Turns out the explanation is that quote marks work in Terminal but not fstab. For the latter, the only way to represent spaces is to replace them with \040. So, this is what fstab should say if you want to stay with plain User Profile in Home (without a hyphen or underscore):

Code: Select all

LABEL=User\040Profile   /home/bfg/User\040Profile   ntfs-3g   defaults,windows_names,locale=en_US.utf8  0  0
As I said earlier in this post, you can do it either way (I've tested both). The important thing is that the mount point and fstab entry match.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

Dumfy
Level 2
Level 2
Posts: 52
Joined: Thu Oct 15, 2015 8:35 am

Re: Creating Extra Root ( / ) Partition

Post by Dumfy »

pbear wrote:
Fri Feb 14, 2020 2:20 pm
ETA: Found it. Turns out the explanation is that quote marks work in Terminal but not fstab. For the latter, the only way to represent spaces is to replace them with \040. So, this is what fstab should say if you want to stay with plain User Profile in Home (without a hyphen or underscore):

Code: Select all

LABEL=User\040Profile   /home/bfg/User\040Profile   ntfs-3g   defaults,windows_names,locale=en_US.utf8  0  0
As I said earlier in this post, you can do it either way (I've tested both). The important thing is that the mount point and fstab entry match.
Well pbear, you got me there in the end! User Profile now automatically mounts when I boot into Mint - brilliant and I can't thank you enough for your help and guidance. Who would've thought that a simple space in a folder name would cause the problem. In the end I opted for the latter option and used \040
The next step for me is to install VirtualBox, so I'm off to look at the manual and watch that YouTube vid again. I'll post back here to say how it went, and mark thread as Solved.

As an aside, you are correct in your assumption regarding my use of root. I used it within File Manager along with the right mouse click option.

User avatar
pbear
Level 10
Level 10
Posts: 3383
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Creating Extra Root ( / ) Partition

Post by pbear »

Dumfy wrote:
Sat Feb 15, 2020 12:38 pm
User Profile now automatically mounts when I boot into Mint
Excellent. Only took so long because I've always avoided the space problem in fstab, so didn't know the rule. Now I do. :)
The next step for me is to install VirtualBox, so I'm off to look at the manual and watch that YouTube vid again. I'll post back here to say how it went, and mark thread as Solved.
That's a separate topic. I think you should go ahead and mark this one solved. No reason for anyone to wade through all that to find out at the end it's already been resolved. If you want to do an epilogue post, that would be fine. If you have any questions, though, please open a new thread. If you remember point #5 in my earlier post, there won't be any issues even tangentially related to this thread.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

Dumfy
Level 2
Level 2
Posts: 52
Joined: Thu Oct 15, 2015 8:35 am

Re: [Solved] Creating Extra Root ( / ) Partition

Post by Dumfy »

Just a quick bit of feedback.

Have installed VirtualBox in both Mint and Windows with the VMs on sdc / User Profile drive as per set up in this thread. All working well and can access and use the VMs as planned in either Mint or Windows. It really is a great way to test new distros etc and see if you like them without interference to your main system.

Thanks again pbear - would be great if I could return the help one day . . .

Dumfy

User avatar
pbear
Level 10
Level 10
Posts: 3383
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: [Solved] Creating Extra Root ( / ) Partition

Post by pbear »

Glad it worked out. Happy Minting!
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

Post Reply

Return to “Installation & Boot”