Mount: unknown filesystem type 'swap'
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
.
Related videos on Youtube
SiliconMind
Updated on September 18, 2022Comments
-
SiliconMind over 1 year
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 0
Gives 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 0
Output 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/cgroup
Also output from
ls
:root@test:~# ls -lh /var/swap.img -rw------- 1 root root 1000M Dec 16 17:55 /var/swap.img
I've also checked man and it's not listing swap as supported filesystem type. I'm confused (is this normal?):
adfs, 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.
-
Zoredache over 8 yearsThat looks like a valid line. My functioning jessie system has this.
/swapfile1 none swap sw 0 0
Can you show us the full fstab? Is/var
on a separate filesystem? Is your swap listed last? -
SiliconMind over 8 years@Zoredache I've updated my question with relevant information. As you can see the
/var
is on root filesystem. -
unforgettableidSupportsMonica over 8 years
swap.img
is a silly name for a swapfile, since it's not a disk image. Instead, considerswap.swp
orswap.dat
orswapfile
.
-
-
SiliconMind over 8 yearsThanks. Having swap in
fstab
is what caused my confusion. I just wanted to test if thefstab
entry for swap is correct, so obvious choice for me was to usemount
. Apparently I was wrong.