/etc/fstab won't execute at boot

Questions about virtualization software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
satimis
Level 3
Level 3
Posts: 111
Joined: Tue Apr 30, 2013 10:43 pm

/etc/fstab won't execute at boot

Post by satimis »

KVM
Host - Ubuntu 20.04
Guest - Linuxmint Edge

Files sharing between Guest and Host

$ cat /etc/fstab

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/sda5 during installation
UUID=2eeaa27a-c0f3-4316-a4d0-f537ab9c2ae8 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=BD9F-09F1  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0
/hostshare /hostfiles 9p trans=virtio,version=9p2000.L,rw 0 0
command

Code: Select all

/hostshare /hostfiles 9p trans=virtio,version=9p2000.L,rw 0 0
won't work.

I have to run below command on Terminal

Code: Select all

sudo mount -t 9p -o trans=virtio /hostshare hostfiles/
$ ls -ald /etc/fstab
-rwxrwxrwx 1 root root 727 Jan 20 21:29 /etc/fstab

Pls help. Thanks

Regards
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
djph
Level 7
Level 7
Posts: 1938
Joined: Thu Jun 27, 2019 5:43 am
Location: ::1

Re: /etc/fstab won't execute at boot

Post by djph »

It's a network device, so I believe you'll need _netdev in your fstab options.
satimis
Level 3
Level 3
Posts: 111
Joined: Tue Apr 30, 2013 10:43 pm

Re: /etc/fstab won't execute at boot

Post by satimis »

djph wrote: Fri Jan 21, 2022 6:17 am It's a network device, so I believe you'll need _netdev in your fstab options.
Could you please explain in more detail ? Thanks

I can't resolve
That line works on /etc/fstab of Ubuntu 20.04
That line doesn't work on the /etc/fstab of Linuxmint and Debian

Regards
djph
Level 7
Level 7
Posts: 1938
Joined: Thu Jun 27, 2019 5:43 am
Location: ::1

Re: /etc/fstab won't execute at boot

Post by djph »

Ubuntu probably stuffed in some hooks elsewhere that Debian / Mint didn't do for some reason or other. Could even be that Ubuntu just stuffs the 9p modules into initramfs (I don't know what Ubuntu does in that regard).

Basically "_netdev" in /etc/fstab tells the mount system to chill out and wait for the network to come up before trying to mount the device.
satimis
Level 3
Level 3
Posts: 111
Joined: Tue Apr 30, 2013 10:43 pm

Re: /etc/fstab won't execute at boot

Post by satimis »

djph wrote: Fri Jan 21, 2022 9:13 am ....
Basically "_netdev" in /etc/fstab tells the mount system to chill out and wait for the network to come up before trying to mount the device.
$ cat /etc/fstab

Code: Select all

.....
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda5 during installation
UUID=2eeaa27a-c0f3-4316-a4d0-f537ab9c2ae8 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=BD9F-09F1  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0
What shall I add there? Thanks

Regards
djph
Level 7
Level 7
Posts: 1938
Joined: Thu Jun 27, 2019 5:43 am
Location: ::1

Re: /etc/fstab won't execute at boot

Post by djph »

Something like this:

/hostshare /hostfiles 9p trans=virtio,version=9p2000.L,rw,_netdev 0 0
satimis
Level 3
Level 3
Posts: 111
Joined: Tue Apr 30, 2013 10:43 pm

Re: /etc/fstab won't execute at boot

Post by satimis »

djph wrote: Fri Jan 21, 2022 11:32 am Something like this:

/hostshare /hostfiles 9p trans=virtio,version=9p2000.L,rw,_netdev 0 0
Tried your suggestion, adding the line on /etc/fstab

~$ cat /etc/fstab

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/sda5 during installation
UUID=2eeaa27a-c0f3-4316-a4d0-f537ab9c2ae8 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=BD9F-09F1  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0
/hostshare /hostfiles 9p trans=virtio,version=9p2000.L,rw,_netdev 0 0
Reboot Linuxmint guest.

This time it can reboot without problem. Host /Home/KVM_Share folder seems mounted, but unable to display its content -> files

On Terminal run;
$ sudo mount -t 9p -o trans=virtio /hostshare hostfiles/

Code: Select all

mount: /home/satimis/hostfiles: /hostshare already mounted on /hostfiles.
Regards
Locked

Return to “Virtual Machines”