Ubuntu 12.04 - How to solve swap error at boot

Ubuntu 12.04 - How to solve "The disk drive for /dev/mapper/cryptswap1 is not ready yet or not present" error at boot

原文地址:

http://punygeek.blogspot.com/2012/10/ubuntu-1204-how-to-solve-disk-drive-for.html


This error comes up when your swap partition cannot be mounted for some reason. Your system will run and for modern systems with lots of RAM, this should not be a problem at all, but you might want to reactivate swap. If you do, it's better you do it the right way, not only by enabling swap, but also making sure that it gets encrypted, like the rest of your home directory.
The way to do it is the following, commands or files are in bold:

  • sudo swapoff -a (turns off swap)

  • comment existing swap configuration in /etc/crypttab
    ex.
    cryptswap1 /dev/sdb8 /dev/urandom swap,cipher=aes-cbc-essiv:sha256

  • comment existing swap configuration in /etc/fstab

    ex.
    /dev/mapper/cryptswap1 none swap sw 0 0

  • re-format swap partition with gparted as linux-swap

  • sudo mkswap /dev/sdXX (create new swap, XX depends on your system and is the partition you formatted earlier, in my case it was sdb8)

  • mark somewhere the UUID value that the previous command returns

    ex.
    Setting up swapspace version 1, size = 4208636 KiB
    no label, UUID=06a9be15-d05b-466d-bfe3-a086bb9cdba0

  • update /etc/initramfs-tools/conf.d/resume with the new UUID

    ex.
    RESUME=UUID=06a9be15-d05b-466d-bfe3-a086bb9cdba0

  • sudo update-initramfs -u (update initramfs)

  • sudo swapon /dev/sdXX (enable swap, XX depends on your setup)

  • sudo ecryptfs-setup-swap (encrypt swap)

now you can check that swap is on by using the commands

free -m
                    total       used       free     shared    buffers     cached
Mem:         11950       6662       5287          0        126       4002
-/+ buffers/cache:       2533       9416
Swap:         4109          0       4109

or

swapon -s
Filename                TypeSize    UsedPriority
/dev/mapper/cryptswap1                  partition      42086360-1


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章