You are not logged in.

#1 2013-02-23 11:51:21

TheFlyingFrenchman
Member
Registered: 2013-02-23
Posts: 9

[SOLVED] UUID of swap file in fstab

Hi everyone,

I am new to Archlinux, and after trying many distros it seems to be the exact flavor I was looking for.

This is much more of a curiosity than an issue.

I installed Arch on a laptop so I need swap to enable the suspend to disk feature. I created a swap file according to the (excellent) wiki.
I noticed that if I put the UUID issued by mkswap in fstab unstead of /swapfile (which, I admit, is not what the wiki says) the system wont startup.
So I tried the method given here. But:

# mkswap -U random /swapfile

fails.
It is also noticeable that lsblk -f does not see the swap file once created (and I guess it may be linked to the fact that system startup fails?).
Putting /swapfile in fstab (as the wiki says) works fine, but we poor sinners are told here that we shall use UUIDs in fstab. In this case I think the confusion between file systems not loaded in the same order and therefore changing name in /dev is not an issue as the swap filename is unique.
So my question is: what is the UUID returned by mkswap for? is it useful in some way?

Last edited by TheFlyingFrenchman (2013-02-24 13:54:13)

Offline

#2 2013-02-23 12:09:13

foutrelis
Developer
From: Athens, Greece
Registered: 2008-07-28
Posts: 705
Website

Re: [SOLVED] UUID of swap file in fstab

Using UUID or LABEL in fstab will only work for partitions; I don't see how it could work for a file.

mkswap treats the swap file the same way as if it were a partition. You can't, however, use its UUID in any meaningful way.

UUIDs and LABELs are useful because the kernel assigns driver letters in a non-predictable way. The problem they solve doesn't exist with files formatted as swap or some other filesystem; you can refer to these by path.

Offline

#3 2013-02-23 13:23:39

TheFlyingFrenchman
Member
Registered: 2013-02-23
Posts: 9

Re: [SOLVED] UUID of swap file in fstab

Ok that was my impression somehow, but I hadn't found it explicitly in any of the wiki or man pages.
I am sure now.
Thank's for the quick and precise answer.

Offline

#4 2013-02-23 23:20:30

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: [SOLVED] UUID of swap file in fstab

Please mark your thread [solved] by editing your original post and tagging the subject line. Thanks!


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#5 2013-02-24 13:52:51

TheFlyingFrenchman
Member
Registered: 2013-02-23
Posts: 9

Re: [SOLVED] UUID of swap file in fstab

Doing it right now.
Sorry!

Offline

#6 2023-06-08 09:09:55

d-tgc
Member
Registered: 2023-06-08
Posts: 1

Re: [SOLVED] UUID of swap file in fstab

Thank you, exactly my issue. Created an account to say thank you! ;-)

big_smile big_smile cool

Offline

#7 2023-06-08 11:13:17

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,410

Re: [SOLVED] UUID of swap file in fstab

Great, but please don't bump 10 year old threads. Closing.

Online

Board footer

Powered by FluxBB