LAB 16.1 - OpenSuse Leap 16 - BTRS filesystem - swapon <file> not allowed
Hi all,
Just FYI:
swapon command does not allow to follow the lab exercise on my OpenSuse 16 (Leap) environment (installed with defaults), throwing the following errors:
v4l4nd3@opensuse16:~> sudo swapon -v swapfile
swapon: /home/v4l4nd3/swapfile: el propietario 1000 del fichero no es seguro; se sugiero 0 (root).
swapon: /home/v4l4nd3/swapfile: firma encontrada [tamaño de página=4096, firma=swap]
swapon: /home/v4l4nd3/swapfile: tamaño de página=4096, tamaño de intercambio=1073741824, tamaño de dispositivo=1073741824
swapon /home/v4l4nd3/swapfile
swapon: /home/v4l4nd3/swapfile: swapon ha fallado: Argumento inválido
Reading the swapon man it says there are some caveats when creating swap files on a BTRFS filesystem.
Regards,
Pablo.
Comments
-
Hi Pablo,
Yes, BTRFS need some few extras. It can be done as follows, from the documentation here:
https://btrfs.readthedocs.io/en/latest/Swapfile.html
1.- I'm running openSUSE Leap 16.
luis@opensuse:~> cat /etc/os-release
NAME="openSUSE Leap"
VERSION="16.0"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="16.0"
PRETTY_NAME="openSUSE Leap 16.0"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:16.0"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
DOCUMENTATION_URL="https://en.opensuse.org/Portal:Leap"
LOGO="distributor-logo-Leap"2.- luis@opensuse:~> truncate -s 0 swapfile
3.- luis@opensuse:~> chattr +C swapfile
4.- luis@opensuse:~> fallocate -l 1G swapfile
I used 1GB for the file, as in the pdf file for this lab.
5.- luis@opensuse:~> chmod 0600 swapfile
6.- luis@opensuse:~> sudo mkswap swapfile
mkswap: swapfile: insecure file owner 1000, fix with: chown 0:0 swapfile
Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)
no label, UUID=88f22c11-6031-49b9-9813-3d921cc7d2b37.- luis@opensuse:~> sudo chown 0:0 swapfile
8.- luis@opensuse:~> sudo swapon swapfile
9.- luis@opensuse:~> cat /proc/swaps
Filename Type Size Used Priority
/dev/sda3 partition 2098152 0 -2
/home/luis/swapfile file 1048572 0 -3I hope that helps!
Regards,
Luis.1 -
Thank you so much Luis.
I will try again on my OpenSuse environment using those BTRFS tricks.Kind regards,
Pablo.1 -
Hi Pablo, it's a pleasure!
Regards,
Luis.0
Categories
- All Categories
- 177 LFX Mentorship
- 177 LFX Mentorship: Linux Kernel
- 750 Linux Foundation IT Professional Programs
- 373 Cloud Engineer IT Professional Program
- 169 Advanced Cloud Engineer IT Professional Program
- 74 DevOps IT Professional Program - Discontinued
- 4 DevOps & GitOps IT Professional Program
- 99 Cloud Native Developer IT Professional Program
- 7.6K Training Courses & Learning Paths
- 1 AI & ML Training
- 1 Blockchain & Decentralized Identity Training
- 5 Cloud & Containers Training
- 1 Cybersecurity Training
- 2 DevOps & Site-Reliability Training
- 1 Linux Kernel Development Training
- 1 Networking Training
- 2 Open Source Best Practice Training
- 1 System Administration Training
- 1 System Engineering Training
- 1 Web & Application Development Training
- 792 Hardware
- 202 Drivers
- 68 I/O Devices
- 37 Monitors
- 95 Multimedia
- 173 Networking
- 91 Printers & Scanners
- 87 Storage
- 769 Linux Distributions
- 81 Debian
- 68 Fedora
- 22 Linux Mint
- 13 Mageia
- 24 openSUSE
- 150 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 356 Ubuntu
- 465 Linux System Administration
- 31 Cloud Computing
- 73 Command Line/Scripting
- Github systems admin projects
- 98 Linux Security
- 78 Network Management
- 101 System Management
- 46 Web Management
- 106 Mobile Computing
- 18 Android
- 73 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 392 Off Topic
- 121 Introductions
- 181 Small Talk
- 29 Study Material
- 956 Programming and Development
- 310 Kernel Development
- 628 Software Development
- 984 Software
- 376 Applications
- 182 Command Line
- 5 Compiling/Installing
- 68 Games
- 317 Installation
- Archived
- 2 LFD140 Class Forum
- 1.4K LFS258 Class Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)