ke, 2022-03-23 kello 11:40 +0000, bradb...@seanet.com kirjoitti:
> I am trying to create a swapfile on my fedora 35 system and do not
> know what I am doing wrong:
> trash>uname -a
> Linux fedora 5.16.15-201.fc35.x86_64 #1 SMP PREEMPT Thu Mar 17
> 05:45:13 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
> 
> If I follow the swapfile instructions on
> https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/s2-swap-creating-file.html
> I get the following result:
> 
> step 1:
> trash>sudo dd if=/dev/zero of=/swapfile bs=1024 count=65536
> 65536+0 records in
> 65536+0 records out
> 67108864 bytes (67 MB, 64 MiB) copied, 0.147119 s, 456 MB/s
> 
> step 2:
> trash>sudo mkswap /swapfile
> mkswap: /swapfile: insecure permissions 0644, fix with: chmod 0600
> /swapfile
> Setting up swapspace version 1, size = 64 MiB (67104768 bytes)
> no label, UUID=f1402a6a-c64c-4f84-9d47-4f8822d2f1d2
> 
> step 3:
> sudo  chmod 0600 /swapfile
> 
> step 4:
> trash>sudo swapon /swapfile
> swapon: /swapfile: swapon failed: Invalid argument
> 

One reason this could happen is if you're trying to create the swapfile
on a btrfs filesystem. In that case you'll need to disable copy-on-
write on that file first:

1. truncate -s 0 /swapfile
2. chattr +C /swapfile
3. dd if=/dev/zero of=/swapfile bs=1024 count=65536
4. chmod 600 /swapfile
5. mkswap /swapfile
6. swapon /swapfile


However, all of this this may not be necessary, since recent releases
of Fedora have zram swap enabled by default anyway.

-- 
Terveisin / Regards,
Matti Pulkkinen

_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to