View Single Post
  #1   (View Single Post)  
Old 15th November 2014
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default FreeBSD 10.1 /etc/fstab error for swap in a KVM VM

I just installed FreeBSD 10.1 in a KVM virtual machine under Linux Mint 17 and noticed that the configured swap was not enabled because of an device naming issue in /etc/fstab.

The error message on the console:
Code:
swapon: /dev/ada0p2: No such file or directory
A quick check showed no swap was listed:
Code:
# swapctl -l
Device:       1024-blocks     Used:

# cat /etc/fstab
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/ada0p2             none    swap    sw              0       0

#  ls -l /dev/ada0p2
ls: /dev/ada0p2: No such file or directory
Checking with gpart:
Code:
#  gpart show -lp
=>      34  41942973    diskid/DISK-QM00001  GPT  (20G)
        34      1024  diskid/DISK-QM00001p1  gptboot0  (512K)
      1058   4194304  diskid/DISK-QM00001p2  swap0  (2.0G)
   4195362  37747645  diskid/DISK-QM00001p3  zfs0  (18G)
Testing to add swap with this device or diskid:
Code:
# swapctl -a /dev/diskid/DISK-QM00001p2
swapctl: adding /dev/diskid/DISK-QM00001p2 as swap device

# swapctl -l
Device:       1024-blocks     Used:
/dev/diskid/DISK-QM00001p2   2097152         0
After editing /etc/fstab:
Code:
# cat /etc/fstab
# Device                        Mountpoint      FStype  Options         Dump    Pass#
#/dev/ada0p2                    none            swap    sw              0       0
/dev/diskid/DISK-QM00001p2      none            swap    sw              0       0
Disabling and enabling swap using /etc/fstab:

Code:
# swapoff -a
swapoff: removing /dev/diskid/DISK-QM00001p2 as swap device

# swapon -a
swapon: adding /dev/diskid/DISK-QM00001p2 as swap device
After a reboot I had swap
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote