Skip to content

Instantly share code, notes, and snippets.

@junex
Created April 14, 2018 03:38
Show Gist options
  • Select an option

  • Save junex/4decb23ad6685d22d4958c8321dd6c41 to your computer and use it in GitHub Desktop.

Select an option

Save junex/4decb23ad6685d22d4958c8321dd6c41 to your computer and use it in GitHub Desktop.

Revisions

  1. junex created this gist Apr 14, 2018.
    32 changes: 32 additions & 0 deletions backup_ubuntu
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    mkdir ~/BACKUP_SYSTEM
    sudo tar -jpcvf ~/BACKUP_SYSTEM/Ubuntu-16.04-20170128-home-z170ud3.tar.bz2 \
    --exclude=/home/sj/BACKUP_SYSTEM \
    --exclude=/proc \
    --exclude=/lost+found \
    --exclude=/sys \
    --exclude=/mnt \
    --exclude=/tmp \
    --exclude=/media \
    --exclude=/dev \
    --exclude=/run \
    --exclude=/boot \
    --exclude=/home/sj/.cache \
    --exclude=/home/sj/Downloads /

    sudo tar -jpcvf ~/BACKUP_SYSTEM/Ubuntu-16.04-2061009-home-z170ud3-efi.tar.bz2 /boot/efi/EFI/ubuntu


    watch -d -n 5 ls -alh ~/BACKUP_SYSTEM/
    watch -d -n 5 ls -s --block-size=M BACKUP_SYSTEM


    mkdir /tmp/root
    mkdir /tmp/root2
    mount /dev/sda1 /tmp/root
    mount /dev/sda2 /tmp/root2
    cd /tmp/root2/jiawzhang/BACKUP_SYSTEM/
    sudo tar -jpxvf Ubuntu-16.04-2061009-home-z170ud3.tar.bz2 -C /tmp/root

    efi boot

    efibootmgr -c -w -L "BootOptionName" -d /dev/sda -p 1 -l\\EFI\\asianux\\elilo.efi