Problem Using fstab To Mount a Drive (KLV-vmHost_rc4)

Moderator: Forum moderators

Post Reply
JusGellin
Posts: 846
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 112 times
Been thanked: 114 times

Problem Using fstab To Mount a Drive (KLV-vmHost_rc4)

Post by JusGellin »

I was trying to use fstab to mount a drive on boot.
So I made an entry like this:
UUID=<some specific UUID> /mnt/usbroot ext4 defaults 0 1

But I found out that /mnt doesn't retain directories on a reboot at least for KLV-vmHost_rc4.
Is there some different way to do this instead of using fstab?
I want this to automatically mount on a reboot.

I was doing this because I wanted to make a storage pool and volume on a usb bootable drive that contains the KLV-vmHost-rc4 virt-manager as a host for virtual machines.
But when I try to do this, and go between different computers I find that sometimes this usb is device sda on one computer and sdb on another
which messes up access to the drives storage pool since the drive is hard coded in the setup.

This happens because on one computer the internal drive is sda and on another the internal drive is nvme0n1
These automatically change to the different devices in /mnt on boot which doesn't work for the storage pool which is locked into only one type of device..

I wanted to use the UUID for the setup, but couldn't get it to work so tried it in fstab instead.

How can I do this using fstab or is there a better different way?

Thanks

Last edited by bigpup on Sat Feb 08, 2025 1:48 pm, edited 1 time in total.
Reason: added specific OS to topic subject
User avatar
fredx181
Posts: 3385
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 437 times
Been thanked: 1484 times
Contact:

Re: Problem Using fstab To Mount a Drive

Post by fredx181 »

JusGellin wrote: Fri Feb 07, 2025 4:12 pm

I was trying to use fstab to mount a drive on boot.
So I made an entry like this:
UUID=<some specific UUID> /mnt/usbroot ext4 defaults 0 1

But I found out that /mnt doesn't retain directories on a reboot at least for KLV-vmHost_rc4.
...

Try in /media (create /media/usbroot directory) and then in fstab:
UUID=<some specific UUID> /media/usbroot ext4 defaults 0 1
.

JusGellin
Posts: 846
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 112 times
Been thanked: 114 times

Re: Problem Using fstab To Mount a Drive

Post by JusGellin »

fredx181 wrote: Fri Feb 07, 2025 4:59 pm

Try in /media (create /media/usbroot directory) and then in fstab:
UUID=<some specific UUID> /media/usbroot ext4 defaults 0 1
.

When I try this, a boot takes me to a sh-5.2# prompt
But I can't do much, other than power down.
Here's what a few lines it ends up with:

Code: Select all

(EE)
Fatal server error
(EE) Could not create lock file in /tmp/.tX0-lock
(EE)
(ee)
Please consult the X.Org Foundation support
at http://wiki.x.org for help.
 (EE)
xinit: giving up
xinit: unable to connect to X srver: Network is unreachable
xinit: server error
xauth: error in locking authority file //.Xauthority
sh-5.2#

I'm able to boot into BW and comment this out in fstab.
When I reboot up to KLV-vmHost, and again uncomment this in fstab and run mount -a,
it properly mounts the usbroot folder and I can access the drive.

So it looks like the mount works, but there is some conflict when a boot occurs.
I can run dmesg when this occurs, but I don't see anything relating to what happens.

JusGellin
Posts: 846
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 112 times
Been thanked: 114 times

Re: Problem Using fstab To Mount a Drive

Post by JusGellin »

I saw a suggestion made on the internet to change the last column from 1 to a 0.
This has to do with whether fsck should check the filesystem before it is mounted. 0 mean to not check it.

This made it work :thumbup: so now I have:
UUID=<some specific UUID> /media/usbroot ext4 defaults 0 0

JusGellin
Posts: 846
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 112 times
Been thanked: 114 times

Re: Problem Using fstab To Mount a Drive

Post by JusGellin »

@fredx181
Thanks for the suggestion to use /media.

JusGellin
Posts: 846
Joined: Fri Jan 19, 2024 11:12 pm
Has thanked: 112 times
Been thanked: 114 times

Re: Problem Using fstab To Mount a Drive

Post by JusGellin »

I must say by using fstab for mounting a /media drive, in this case the operating system on a usb, looks to be very powerful.

The existing mount for the drive can move around for its device designation of sda and sdb depending on what
the internal drive has.
In the case of an internal nvme0n1p drive, it would get the sda folder to mount for the usb.
On another computer that has a sda internal drive would get sdb folder to mount for the usb.

The drive a bootable usb uses changes that device designation.

Then if an application requires a hard path to a directory, it would be a problem since the /mnt/ switches for sda and sdb.
This happens for virt-manager when setting up storage pools and volumes.

Setting up the mount for /media/usbroot solves that problem since the hard path doesn't change for that directory.

This appears to work well for me so far in doing this unusual attempt to put a full frugal system on an usb.
I plan on having usb drives that have the operating systems on to be used just once in a while for testing on different computers.

This is just a different way for testing.

Post Reply

Return to “KL-Dev_Work”