Skip to content

Instantly share code, notes, and snippets.

@theonewolf
Created September 9, 2014 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theonewolf/0322b9bea8edb5150f70 to your computer and use it in GitHub Desktop.
Save theonewolf/0322b9bea8edb5150f70 to your computer and use it in GitHub Desktop.
Bytes on Pristine Swap Partition
➜ tmp>truncate --size 1G testswap
➜ tmp>hexdump -C testswap
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
40000000
# Note the file starts as complete zeros
# Let's find out what happens when we "create/initialize" swap space
➜ tmp>mkswap -f testswap
Setting up swapspace version 1, size = 1048572 KiB
no label, UUID=5c1fddda-d28a-446e-8dc3-0e01c54389f7
# Sounds like something happened...
# And indeed the file is no longer all zeros:
➜ tmp>hexdump -C testswap
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000400 01 00 00 00 ff ff 03 00 00 00 00 00 5c 1f dd da |............\...|
00000410 d2 8a 44 6e 8d c3 0e 01 c5 43 89 f7 00 00 00 00 |..Dn.....C......|
00000420 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000ff0 00 00 00 00 00 00 53 57 41 50 53 50 41 43 45 32 |......SWAPSPACE2|
00001000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
40000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment