FAA Using LABEL together with <file> args to swapon?
Posted: 26 Mar 2015, 05:19
Hi,
I like using LABEL in my changes= cheatcode.
I'd like to use the disk label in a swapon command, but I don't have a dedicated swap partition. Therefore I would like to refer to swap using both a LABEL designation and a file name.
I've tried the following and included the resulting error messages:
root@porteus:/# swapon -L PorteusBase1/porteus.swap
swapon: cannot find the device for PorteusBase1/porteus.swap
root@porteus:/# swapon -L PorteusBase1 porteus.swap
swapon: /dev/sdc1: read swap header failed: Invalid argument
swapon: porteus.swap: stat failed: No such file or directory
root@porteus:/dev/disk/by-label# swapon /dev/disk/by-label/PorteusBase1/porteus.swap
swapon: /dev/disk/by-label/PorteusBase1/porteus.swap: stat failed: Not a directory
I can't find any examples of swapon that do what I want, or even an indication that it's possible.
But it certainly should be.
Is my syntax bad, does swapon need fixing, or is Porteus pulling a fast one on me?
Oh: I don't want to swap within my save.dat if only because it's encrypted. I'd imagine the performance penalty would be pretty high.
Repartitioning would be an obvious workaround, but we all hate workarounds, right?
-jeff
Anecdote follows:
The biggest mistake I ever made as a UNIX consultant was to start swapping on the traditional swap partition designation of a disk that was entirely mounted as a file system, ie: the drive was mounted as /dev/sda1 and I swapped on /dev/sda3, as I recall partition 3 was typically swap (20 years ago) whereas partition 1 represented the whole disk (part 2 was typically root, part 4 was var or what have you).
The system happily started swapping straight (raw) into a chunk of the files system. Hilarity ensued.
So naturally I'm a little paranoid about swap. These days I think swapon is more careful not to do that kind of thing, and I think the practice of defining overlapping partitions is deprecated. Heck, I don't think we even had swapon back then: just mounted with type swap in fstab.
I like using LABEL in my changes= cheatcode.
I'd like to use the disk label in a swapon command, but I don't have a dedicated swap partition. Therefore I would like to refer to swap using both a LABEL designation and a file name.
I've tried the following and included the resulting error messages:
root@porteus:/# swapon -L PorteusBase1/porteus.swap
swapon: cannot find the device for PorteusBase1/porteus.swap
root@porteus:/# swapon -L PorteusBase1 porteus.swap
swapon: /dev/sdc1: read swap header failed: Invalid argument
swapon: porteus.swap: stat failed: No such file or directory
root@porteus:/dev/disk/by-label# swapon /dev/disk/by-label/PorteusBase1/porteus.swap
swapon: /dev/disk/by-label/PorteusBase1/porteus.swap: stat failed: Not a directory
I can't find any examples of swapon that do what I want, or even an indication that it's possible.
But it certainly should be.
Is my syntax bad, does swapon need fixing, or is Porteus pulling a fast one on me?
Oh: I don't want to swap within my save.dat if only because it's encrypted. I'd imagine the performance penalty would be pretty high.
Repartitioning would be an obvious workaround, but we all hate workarounds, right?
-jeff
Anecdote follows:
The biggest mistake I ever made as a UNIX consultant was to start swapping on the traditional swap partition designation of a disk that was entirely mounted as a file system, ie: the drive was mounted as /dev/sda1 and I swapped on /dev/sda3, as I recall partition 3 was typically swap (20 years ago) whereas partition 1 represented the whole disk (part 2 was typically root, part 4 was var or what have you).
The system happily started swapping straight (raw) into a chunk of the files system. Hilarity ensued.
So naturally I'm a little paranoid about swap. These days I think swapon is more careful not to do that kind of thing, and I think the practice of defining overlapping partitions is deprecated. Heck, I don't think we even had swapon back then: just mounted with type swap in fstab.