Fedora 41
I’m trying to create a swap area on a dedicated partition. I’m reading the mkswap
man page, and I have a question on that.
Here is my partition configuration on the external hard drive that I will use to hold the swap area.
$ lsblk -b -i -o name,fstype,fsver,label,partlabel,partuuid,uuid,size
NAME FSTYPE FSVER LABEL PARTLABEL PARTUUID UUID SIZE
sda 2000365289472
|-sda1 ext4 1.0 disk2s1 disk2s1 baaed8f5-307f-439a-9df6-1c6943b7a78e c4c592ac-e97a-42a3-8671-a6e8a54f27fc 965998542848
|-sda2 ext4 1.0 disk2s2 disk2s2 e63e835d-4bd9-4080-ad7d-0ade6e6881bf ddf57568-9704-4426-9a07-5c4c6d932946 434000363520
|-sda3 ext4 1.0 disk2s3 disk2s3 188ca273-2588-414a-89dc-cb4141f84f02 9db4ba26-573c-431e-af61-664330d4ed99 434000363520
`-sda4 ext4 1.0 disk2s4 b09cc65d-8e56-42ec-be32-b1f266a4bf27 6337d4af-12ea-4235-8311-60a92993a49b 137999941632
I will use partition /dev/sda4
for the swap area.
And here is my /etc/fstab
file (excerpted to show only the entries on the external hard disk to contain the swap partition):
# fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno
LABEL=disk1s1 /mnt/disk1s1 ext4 auto,noexec,nosuid,nodev,nofail 0 0
LABEL=disk1s2 /mnt/disk1s2 ext4 defaults,nofail 0 0
LABEL=disk1s3 /mnt/disk1s3 ext4 defaults,nofail 0 0
LABEL=disk1s4 none swap sw,nofail 0 0
I don’t understand the following quote excerpted from the man page:
After creating the swap area, you need the swapon(8) command to start using it. Usually swap areas are listed in /etc/fstab so that they can be taken into use at boot time by a swapon -a command in some boot script.
According to the mkswap
man page, after I run mkswap
, I need to run swapon
. I believe that the swap partition will be mounted and available to the system when I boot because it is defined in /etc/fstab. Is this accurate? In other words, I don’t have to run swapon in a startup script (or manually after boot) do I?