I know what this command does. It sets up swap area on a device or in a file.
The device being a partition, and file being a simple file.
But I want to know what it does internally on the disk.
Correct me here if I am wrong, Swap is slower than RAM, but faster than simple Disk for operations.
This is my question.
What changes does mkswap
makes on disk? I mean, the swap area is still on disk (be it a partition or a file), right?, then how come it works faster than rest of the disk? It must be doing some changes on the disk? What are these changes?
EDIT - It is in reference to this video, https://www.youtube.com/watch?v=uxiis-K6v7w
here it is being told that data accessed frequently is moved to the outer area of the disk. So, I guess mkswap
might move the swap partition/file to some outer area of the disk.
mkswap
does to a logical file or physical partition except maybe, as the question states, moves it's logical allocation to a contiguous place on the physical disk. @Ravexina links to a question whose accepted answer also properly answers this question: https://askubuntu.com/questions/846163/does-swap-space-have-a-filesystem ... even though the question isn't aboutmkswap
it does a great job of explaining whatmkswap
actually does. Theanswer here
link above does not. – Jonathan Dec 18 '18 at 03:08