2

My friend whats to create a 4GB swap file on his ext4 file system. because he is using a chromebook acer c7 the way he installed he did not have a chance to specify swap partition

and now he want to create a swap file on his file system.

This is the guide he is following

http://ubuntuforums.org/showthread.php?t=1618220&p=10098565#post10098565

First you have to create a 2GiB file, for example in /mnt:

sudo dd if=/dev/zero of=/mnt/swap bs=1M count=2048

Then format the file to swap:

sudo mkswap /mnt/swap

Add the swap file to the system:

sudo swapon /mnt/swap

Check it out, i.e.:

free -m

Edit the fstab file:

gksu gedit /etc/fstab

and add this line at the end of the file:

/mnt/swap  none  swap  sw

Save the file and exit. That's all.

This is what he is getting

enter image description here

user@chrubuntu:~$ sudo swapon /mnt/swap
swapon: /mnt/swap: swapon failed: Invalid argument

and his fstab looks like this

fstab

any way to fix this ??

One more thing he is using ubuntu 14.04 and it is not a fresh install

Thank you for your time

Levan
  • 11,118

2 Answers2

1

It's possible the problem is because it's in the /mnt directory or it could be a security issue world readable swap isn't great. Try this tutorial and see if you have better results.

http://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/

Elder Geek
  • 36,752
0

swapon failed: Invalid argument

Based on this discussion and this post, most likely your file system doesn't support swap files.

You need to create it somewhere outside of /mnt, as part of the native filesystem (e.g. in /var).

Try following these steps instead.

kenorb
  • 10,944