howto remove swap (/dev/sdb2 ) from system boot

Hi, everyone:
I install a opensuse leap 42.1 as a little server. with two disk on raid1 (/dev/sda and /dev/sdb).

Both disk have exactly the same parition tables,
/dev/sdx1 EFI
/dev/sdx2 swap
/dev/sdx3 md0 / (root fs)
/dev/sdx4 md1 /srv (server data as network folders, emails, etc)

Due a mistake at install, the installer has formated and use both swaps (/dev/sda2 & /dev/sdb2). At this moment and for other reasons i need remove /dev/sdb disk (and replace for other more greater).
So i do as allways do, comment out the line that mount swap on FSTAB file.

#UUID=fc78ffcc-da23-4e39-aa40-0039f5d4acfe swap swap defaults 0 0
#UUID=6500c333-fadb-4ac6-a629-86641f11cfbf swap swap defaults 0 0

/dev/sda2        swap swap defaults 0 0

UUID=739e0500-ba15-4679-bee4-22817aeae2f6 / btrfs defaults 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /boot/grub2/i386-pc btrfs subvol=@/boot/grub2/i386-pc 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /boot/grub2/x86_64-efi btrfs subvol=@/boot/grub2/x86_64-efi 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /home btrfs subvol=@/home 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /opt btrfs subvol=@/opt 0 0
#UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /srv btrfs subvol=@/srv 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /tmp btrfs subvol=@/tmp 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /usr/local btrfs subvol=@/usr/local 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /var/crash btrfs subvol=@/var/crash 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /var/lib/libvirt/images btrfs subvol=@/var/lib/libvirt/images 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /var/lib/mailman btrfs subvol=@/var/lib/mailman 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /var/lib/mariadb btrfs subvol=@/var/lib/mariadb 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /var/lib/mysql btrfs subvol=@/var/lib/mysql 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /var/lib/named btrfs subvol=@/var/lib/named 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /var/lib/pgsql btrfs subvol=@/var/lib/pgsql 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /var/log btrfs subvol=@/var/log 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /var/opt btrfs subvol=@/var/opt 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /var/spool btrfs subvol=@/var/spool 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /var/tmp btrfs subvol=@/var/tmp 0 0
UUID=739e0500-ba15-4679-bee4-22817aeae2f6 /.snapshots btrfs subvol=@/.snapshots 0 0
UUID=EC2F-39DA       /boot/efi            vfat       umask=0002,utf8=true  0 0
/dev/md1        /srv    ext4    defaults 0 0

But this does not work, the system never boot and freeze saying the following:

Starting Dracut Emergency shell.
warning: /dev/disk/by-uuid/6500c333-fadb-4ac6-a629-86641f11cfbf does not exits 
warning: boot has failed. to debug this issue add " rd.debug" to the kernel.......
FAILED failed to start dracut emergency shell
see systemctl status dracut-emergency.service

The curious is after boot the system only mount and work with /dev/sda2 swap.

How i can remove /dev/sdb disk safely and fix the dracut?

If sda is your primary disk in your RAID 1 disk mirror,
You should be able to break your mirror and safely run only sda which would mean automatically using only the swap partition on sda (you wouldn’t want to disable or remove that).

If the swap on sda is only a typo and you really meant the swap on sdb, IMO breaking the mirror should take care of that automatically.


I have not used RAID, so I cannot comment on that aspect.

In general, to make changes to swap, you would need to:

  • Modify “/etc/fstab”
  • Modify “/etc/default/grub” (particularly the “resume” option
  • rebuild the “initrd” (with “mkinitrd”)
  • rebuild grub.cfg with “grub2-mkconfig -o /boot/grub2/grub.cfg”.
  • Reboot
1 Like

Excelent !!! thanks you.

because the server never suspend (or hibernate) i can simply remove the “resume” option on /etc/default/grub ?

Yes. Or replace it with “noresume”.

Thanks you, its done and everything is working

I’m glad to hear that.


I’m not entirely clear how you made your mistake.

If you created your mirror volume as the whole disk (typically starting on sda), then everything on that disk should be mirrored to the other disk, including the swap partition if it is on the original disk.

If you defined your mirror differently (eg just your boot, root and /home partitions), then that might be a different case.

If the entire disk was mirrored, I’d <expect> that it would be normal for the swap partition you’re trying to remove would also exist and perform normally as part of the mirror.

There are benefits and drawbacks to configuring a mirrored swap.

So, although you asked how to not mount the swap on your second disk, I wonder if that is actually what you want to do.


Hi, sorry for the late, but i think that is valuable my answer.
This happen because the installer have several bugs specially partitioning.
First and big bug is that does not allow overwrite a old installed linux. For example if you try to install after have a incident (DVD scratch, power fail during install, etc). When you want overwrite an failed install, you know that the data are wrong but the partition table are good only need to be formated, but the only way to re-start a failed install is erase all partitions booting on another live linux dvd or pendrive.

Second bug: When the disk are clean the openSuse Installer suggest use UEFI BOOT. But if the disk are NOT clean UEFI boot are not possible and only option is srink the last partition and install on them.

I dislike of this, because many times i reinstall /sda1 /sda2 /sda3 and keep the data untouched on /sda4

Now the direct answer to your question. When i use the installer i create two same partitions.
For example is the installer suggest /dev/sda2 start cylinder 63 and end on cylinder 2480 ( example numbers)
i create /dev/sdb2 start cylinder 63 and end on cylinder 2480

Obviously i copy both complete partitions in this mode sdx1,sdx2,sdx3,sdx4,sdx5, this include the data partitions and swaps partitions. Sadly the installer take for use as regular swap the partition on /dev/sdb when only must be used when /dev/sda fail.

I hope that this was helpful to you. And thanks for all help.

When you get to the partitioning section, click “Create partitioning”
On the next screen, select “custom partitioning”.

You should see a list of current partitions. You can right-click on any partition, and select “edit” to change how it will be used. You might need to tell it to not mount swap partitions if you don’t want to use them. And you will need to have at least a partition for “/”, which should be set to be formatted and mounted. On a UEFI box, you will also need the EFI partition to be mounted at “/boot/efi”.

Also if installing the same version use upgrade option (yes even the same version) and it will use exiting partitioning and preserve home.

You can also take control and assign any partitioning you want.

The installer do not allow UEFI if are another partitions on disk. You can define the old /boot/efi as new /boot/efi but the installer configure the grub to not use them and a RED LETTER say the system will not boot. I need restart the installation 4 o5 times because differents issues related with dvd reader.

This time i dont use update, in older installer the update does not allow format the partitions.

i hope this comments are helpfull to the developers, i do with the best collaboration spirit.

Best Regards

That’s not my experience. But perhaps that happens if your system is already using legacy MBR partitioning. In that case, the installer wants to switch to GPT partitioning, and having other partitions could present a problem with that.

My preferred way if installing is to partition first, before starting the install. I use either “fdisk” or “gdisk” to partition the way that I want. Then, when I boot the installer, it is a matter of selecting which existing partitions to use.

Still you can go to expert mode and set the partitions as you wish.

If you boot the installer in legacy mode no you can not do an EFI install it defaults to MBR install. Must boot installer in EFI mode then it will use the existing efi boot

I agree with you about first partitioning all, and that the installer use my predefined partitions, i do on this way since mi first suse 6.4 install.

Is a dedicated server, on a low consumption motherboard biostar n3050nh with 2 disk of 3TB. The old server was BIOS/mbr based with two 3Tb disk and was problematic.

First install with empty disk suggest UEFI, (install aborted or incomplete). Second install sugest shrink the data partition and use GPT, i cant find to switch to UEFI.

I think that is like say gogalthorp, i have not enough skill to configure grub2 manually to force installer to use UEFI was my first install in UEFI systems.

Thanks for share your experience

It depends on how you boot the installer. In order to install for UEFI, you must boot the install media in UEFI mode. Exactly how to do that depends on the BIOS. If there is a setting to prefer UEFI or to boot UEFI only, then use that when booting the installer.

I dont know how choose the type of boot, i simply put the opensuse DVD and turn on the computer.

On one of my computers, I can hit F12 during boot. It gives me several boot options. One of the options is to boot the installer with UEFI and another is to boot with legacy MBR booting.

On my other UEFI computer, I only get one option to boot the installer. If I have set the BIOS to prefer EFI booting, then that’s the choice I get. If I have left it at the default of preferring legacy booting, then it only offers to boot the installer in legacy mode.

It all depends on the BIOS.

Ok, as the problem was installing my server i cant play with this. But i think that the installer must allow choose anyway.