Keep Receiving Message: Invalid Option

October 7, 2014 2.1k 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?

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
Have another answer? Share your knowledge.