[태그:] hibernation

  • Ubuntu 20.04 hibernation

    패키지 설치

    sudo apt install pm-utils hibernate

    /swapfile 확인.

    cat /proc/swaps
    Filename				Type		Size	Used	Priority
    /swapfile                               file		2097148	0	-2

    UUID 확인

    findmnt -no UUID -T /swapfile
    5c0028fe-edc4-4b17-93d0-b78fda1f83b8

    여기서 UUID 기록.

    오프셋 확인

    sudo filefrag -v /swapfile
    Filesystem type is: ef53
    File size of /swapfile is 2147483648 (524288 blocks of 4096 bytes)
     ext:     logical_offset:        physical_offset: length:   expected: flags:
       0:        0..   32767:      34816..     67583:  32768:            
       1:    32768..   63487:      67584..     98303:  30720:            
       2:    63488..   96255:     100352..    133119:  32768:      98304:
       3:    96256..  126975:     133120..    163839:  30720:            
       4:   126976..  159743:     165888..    198655:  32768:     163840:
       5:   159744..  190463:     198656..    229375:  30720:            
       6:   190464..  223231:     231424..    264191:  32768:     229376:
       7:   223232..  253951:     264192..    294911:  30720:            
       8:   253952..  286719:     296960..    329727:  32768:     294912:
       9:   286720..  319487:     329728..    362495:  32768:            
      10:   319488..  352255:     362496..    395263:  32768:            
      11:   352256..  385023:     395264..    428031:  32768:            
      12:   385024..  417791:     428032..    460799:  32768:            
      13:   417792..  450559:     460800..    493567:  32768:            
      14:   450560..  481279:     493568..    524287:  30720:            
      15:   481280..  514047:     557056..    589823:  32768:     524288:
      16:   514048..  524287:     589824..    600063:  10240:             last,eof

    여기서 physical_offset: 의 처음인 34816을 기록.

    /etc/default/grub 파일 수정

    아래 예시처럼 변경.

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=5c0028fe-edc4-4b17-93d0-b78fda1f83b8 resume_offset=34816"

    GRUB 업데이트

    sudo update-grub

    /etc/initramfs-tools/conf.d/resume 파일 생성

    내용은 아래처럼.

    RESUME=UUID=5c0028fe-edc4-4b17-93d0-b78fda1f83b8 resume_offset=34816

    initramfs 재생성

    sudo update-initramfs -c -k all

    재부팅 후, hibernation 확인

    sudo systemctl hibernate