Keep Receiving Message: Invalid Option

Posted October 7, 2014 2.6k views

I am trying to use the command fallocate to create a swapfile for memory purposes. Every time I use the command: sudo fallocate -1 2G /swapfile, the message I get back is: fallocate: invalid option – ‘1’.

How do I resolve this problem?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

Replace -1 with -l (a lowercase L):

       -l, --length length
              Specifies the length of the allocation, in bytes.

So the command should be:

sudo fallocate -l 2G /swapfile
Submit an Answer