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
- 175 LFX Mentorship
- 175 LFX Mentorship: Linux Kernel
- 745 Linux Foundation IT Professional Programs
- 372 Cloud Engineer IT Professional Program
- 168 Advanced Cloud Engineer IT Professional Program
- 73 DevOps IT Professional Program - Discontinued
- 3 DevOps & GitOps IT Professional Program
- 98 Cloud Native Developer IT Professional Program
- 7.6K Training Courses & Learning Paths
- AI & ML Training
- Blockchain & Decentralized Identity Training
- Cloud & Containers Training
- Cybersecurity Training
- DevOps & Site-Reliability Training
- Linux Kernel Development Training
- Networking Training
- Open Source Best Practice Training
- System Administration Training
- System Engineering Training
- Web & Application Development Training
- 2 LFD103-JP クラス フォーラム
- 4 LFD210-CN Class Forum
- 764 LFD259 Class Forum
- 681 LFS101 Class Forum
- 2 LFS158-JP クラス フォーラム
- 162 LFS207 Class Forum
- 3 LFS207-DE-Klassenforum
- 4 LFS207-JP クラス フォーラム
- 61 LFS241 Class Forum
- 52 LFS242 Class Forum
- 42 LFS243 Class Forum
- 19 LFS244 Class Forum
- 4 LFS250-JP クラス フォーラム
- 166 LFS253 Class Forum
- 19 LFS256 Class Forum
- 1.4K LFS258 Class Forum
- 165 LFS261 Class Forum
- 26 LFS267 Class Forum
- 792 Hardware
- 202 Drivers
- 68 I/O Devices
- 37 Monitors
- 95 Multimedia
- 173 Networking
- 91 Printers & Scanners
- 87 Storage
- 768 Linux Distributions
- 81 Debian
- 67 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
- 105 Mobile Computing
- 18 Android
- 72 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 392 Off Topic
- 121 Introductions
- 181 Small Talk
- 29 Study Material
- 944 Programming and Development
- 310 Kernel Development
- 616 Software Development
- 976 Software
- 368 Applications
- 182 Command Line
- 5 Compiling/Installing
- 68 Games
- 317 Installation
- Archived
- 2 LFD140 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)