I'm running vanilla Debian Jessie and I need to enable swap file. It works fine when I use swapon /var/swap.img but I'm unable to make it mount with fstab at boot time.
The following entry in fstab:
/var/swap.img none swap sw 0 0Gives this error:
Error mounting none: mount: unknown filesystem type 'swap'
What is the proper way to mount swap file on Debian with fstab?
[Update]
Adding all entries from fstab:
root@test:~# grep -v "#" /etc/fstab
UUID=lorem-ipsum / ext4 errors=remount-ro 0 1
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
/var/swap.img none swap sw 0 0Output from df:
root@test:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 20G 2.9G 16G 16% /
udev 10M 0 10M 0% /dev
tmpfs 99M 8.4M 91M 9% /run
tmpfs 248M 0 248M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 248M 0 248M 0% /sys/fs/cgroupAlso output from ls:
root@test:~# ls -lh /var/swap.img
-rw------- 1 root root 1000M Dec 16 17:55 /var/swap.imgI've also checked man and it's not listing swap as supported filesystem type. I'm confused (is this normal?):
3adfs, affs, autofs, btrfs, cifs, coda, coherent, cramfs, debugfs, devpts, efs, ext, ext2, ext3, ext4, hfs, hfsplus, hpfs, iso9660, jfs, minix, msdos, ncpfs, nfs, nfs4, ntfs, proc, qnx4, ramfs, reiserfs, romfs, squashfs, smbfs, sysv, tmpfs, ubifs, udf, ufs, umsdos, usbfs, vfat, xenix, xfs, xiafs.
1 Answer
You don't mount the swap partition or swapfile with mount, you use the swapon command. (The swap partition or file isn't really a filesystem that can be mounted and hold files, it's an area of the disk the kernel uses directly).
swapon -a will enable all swaps from /etc/fstab.