I want to know how to “move” or “use” a different SWAP partition in Rockstor.
After a stock install:
# lsblk -l
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 16G 0 disk
sda1 8:1 0 2M 0 part
sda2 8:2 0 64M 0 part /boot/efi
sda3 8:3 0 2G 0 part [SWAP]
sda4 8:4 0 13.9G 0 part /opt
/var
/home
/boot/grub2/x86_64-efi
/boot/grub2/i386-pc
/usr/local
/tmp
/.snapshots
/srv
/root
/
And I don’t want to have the SWAP partition (/dev/sda3) in the same boot disk. So the question is: How to not create it when installing? And how to put it in another “system” disk?
Use cases:
BOOT is USB memorystick, and SWAP will be placed in USB 3.0 SSD (that is NOT the boot disk).
BOOT is a RAID-1 mirror, and SWAP is in another fast non-RAID disk.
Please, help me to support these scenarios.
At time, the selection of SWAP partition location is a must have in production environments.
You can look at the custom installer repository to see whether you can influence the disk layout for your purposes, so that during install your SWAP partitions will be loaded differently:
However, I have not tried any of that, so not much knowledge there.
Otherwise, you should be able to “move” the swapfile to another device using normal Linux procedures. For btrfs there are some special considerations. Here is some documentation:
and here’s some discussion around swap files on btrfs (albeit for Ubuntu as the underlying OS, but the concepts are the same):
As for making this part of the official install, I have to defer to @phillxnet.
My 2 cents, in a production environment, I would not rely on a USB memory stick (RAID-1 or not), but a small size high-quality SSD setup (as you can see the basic disk space requirements for Rockstor are fairly low).
Regarding the “custom intsaller repository” I don’t know anything about it. This is my first install of Rockstor (but more than 10 years of I.T. expertice) and I’ve done only a standard install from the ISO. So, the simple question: Any guide to tweak the install? Or this can be done manually during the install process?
In reference about how to manage a SWAP partition, this is out of question. I know sufficient about it. Here the problems are two: 1) How to not create a swap partition in the boot disk when installing? 2) How to create a secondary system disk (aka not data disk that doesn’t have partitions) in Rockstor? I think that only the boot disk is managed as system, and any others are data. Therefore, the problem here is how to identify an additional disk as system.
And regarding the SWAP in BTRFS, it’s also out of scope. Rockstor creates a regultar partition for swap in the boot disk. So, it’s not swap over btrfs.
Finally, in reference to the USB boot disk, this is only one example of one use case. My use case, is that in my environment, ALL swap space is placed in different disks. The cause is simple: all boot disks are replicated (RAID-1), and all swap space is on regular (fast) disks (no raid, no RAID-0). This is a good practice. And the problem with Rockstor is that this seems to not be supported.
Anyway, if this will never be supported (additional system disk with swap space), almost I need the support to remove the creation of the swap partition in the boot disk when installing. Any help for simple guide?
You can’t modify the setting the swap creation in the installer, but after installation you have a Linux operatingsystem (openSUSE) where you can do all the modifications you like.
In the Rockstor webUI this is not possible. But from a Terminal, you can create new Swap partitions as on any other Linux machine:
Notes:
You can format either (1) the whole disk (e.g. /dev/sda) for swap or (2) only a partition of a disk as explaned in the tutorial linked above.
As stated above, you can’t easily influence the creation of a swap partition on the boot disk, but you can permanently disable the usage of this swap partition.
When you follow the Making the Swap Permanent section of the tutorial you should see the boot disk swap partition in /etc/fstab. When you replace this line with your newly created swap partition (or remove it entirely) you disable the boot disk swap partition permanently.
Hi @simon-77 and thank you for your responses too.
However,
The problem here is not how to add swap space to Rockstor. This is out-of-scope! All of us know how to partitionate a disk, create a swap space and add it to the system.
The questions are others…
Questions:
We need not to disabling the swap partition space on the boot disk. What we need is to disable the creation of it. We don’t need 2GB not used in the boot disk. That’s the first key question. @Hooverdan say that it’s possible to tweak the install to disable it. So, how to do it? And futhermore, why the install process is not requesting about the partitioning config? Almost a simple SWAP ON/OFF question is a must have.
The second key question is regarding to connected disks that aren’t data disks. The boot disk is detected as “Rockstor System Drive”. But any SWAP only disk, has to be detected as an additional system disks. And this is not true now.
A simple guide to almost “disable” swap in the boot disk, and set it in another disk. This is not a solution, but a workaround until this will be supported:
Connect the swap disk to the server and boot it.
In the terminal execute the commands to: partitioning the new disk, create the swap partition, make the swap space, label it, use it, disable swap in boot disk, remove the swap partition in the boot disk.
Regarding these steps, it’s relevant to execute “swaplabel -L SWAP /dev/sdb1” (assuming that the “sdb” is the disk with the new created swap partition). Without this command the boot process will fail because when you remove the original swap partition the “dev/disk/by-label” will not found the SWAP space described in “/etc/fstab”.
Thanks for sharing your current notes on that particular modification. I’ll try to clarify things a bit as I believe there are some important notes that would explain a lot and clarify your current questions.
It is indeed important to keep in mind that Rockstor is designed as an appliance to provide a user friendly and an easy-to-use way to leverage the features of Btrfs for a NAS use. As a result, all design decisions made in the Rockstor project are made by its community via contributions and under the angle of easy-to-use/simple way to achieve otherwise complex tasks.
The installation of Rockstor thus needs to follow this philosophy and we thus leverage the most straightforward installation method used by opensuse via their OEM self-expanding Minimal VM. Our installer is thus heavily using that approach and that provides a very quick and simple installation for all users. This makes it very easy to reinstall as needed and helps a lot of folks. This is why advanced configurations options such as what you are looking for cannot be supported in the installer that we build and release.
That being said, all of this work is done in the open, which is why you can find our installer recipe and instructions on to customize this for users who may want to. This is part of what was linked earlier in this thread.
If this is not an option for you, it’s a not a problem at all. As mentioned above, Rockstor is just pure linux so you can do anything that Linux offers. It seems you know that very well as you shared your own way to achieve what you wanted (or part of?) so I’m glad you were able to get there quickly.
Another benefit of leaving options opened to folks who want to, is that you can also install Rockstor on top of a vanilla Opensuse install, which means you can use the full-fledged OpenSUSE installer that offers and supports more complex installation scenarios; this could very well be a good fit for you. See our docs on that: Install on Vanilla openSUSE/SuSE SLES — Rockstor documentation
I hope this helps clarify things a bit, and thank you again for sharing your customizations here so that others may benefit from them too.
Based on what you asked about, I believe the option of installing Rockstor on a vanilla OpenSUSE install might be a better fit for you as you will have access to its graphical interface and wide range of options to partition, etc… you will thus be able to create the exact partitioning you desire on any disk you desire.
@Flox is probably correct with his recommendation to give you ultimate flexibility on disk layouts, etc.
If you still decide to build your own installer as a starting point (and then perform additional actions on the command line like adding swap on another device), you can probably achieve the starting position of having no swap created during the install by changing these lines in the rockstor.kiwi file:
the oem-swap variable is by default false, so removing these lines will result in no swap section in the resulting installer iso. This is assuming, your scenarios are around using x86_64 architecture. Otherwise you have to look at the other profiles defined and adjust the same variables accordingly.
To clarify, the rockstor.kiwi file is the basis for kiwi-ng to create an iso-installer, it’s not like an ini file that’s referenced during installation of an existing iso file.