2016年6月13日 星期一

[Gentoo] How to backup & restore gentoo os

Backup system by using tar
Boot from the liveCD

mkdir /mnt/gentoo
mkdir /mnt/backup
mount /dev/sda2 /mnt/gentoo
mount /dev/sda1 /mnt/gentoo/boot
mount /dev/sda3 /mnt/gentoo/home/happy

time tar -cvvjpf /mnt/gentoo/home/happy/gentoo_backup.tgz -C /mnt/gentoo

Restore the tar file into system
mount /dev/sda2 /mnt/gentoo
mount /dev/sda1 /mnt/gentoo/boot

tar xvvfh gentoo_backup.tgz -C /mnt/gentoo

Following command need to do, otherwise when execute chroot won't find /bin/bash under gentoo enviroment.

tar -xmvvf stage3-amd64-20150730.tar.bz2 -C /mnt/gentoo
tar -xmvvf portage-20150804.tar.xz       -C /mnt/gentoo/usr/

After restore the system need to create new fstab.
Make sure /dev/sda2 will boot under read/write mode.
genfstab -U -p /mnt/gentoo >> /mnt/gentoo/etc/fstab

Install two package, one is for boot, the other one is for kernel & initramfs.


# emerge genkernel (Gentoo automatic kernel building scripts)

# mkdir -p /etc/portage/package.accept_keywords
# echo "sys-boot/gummiboot" >> /etc/portage/package.accept_keywords/efi
# emerge sys-boot/gummiboot

Compile kernel & install kernel first.

cd /usr/src/linux
make
make modules_install
make install 


After install will install following stuff under /boot


config-4.4.6-gentoo
System.map-4.4.6-gentoo
vmlinuz-4.4.6-gentoo
Using genkernel to create initramfs under /boot.

# genkernel --install initramfs

Using gummiboot create booting stuff.

# gummiboot --path /boot install
Edit /boot/loader/entries/gentoo.conf to make booting configuration.

title Gentoo Linux  (Title name need the same)
initrd /initramfs-genkernel-x86_64-4.4.6-gentoo (Init image)
linux /kernel-genkernel-x86_64-4.4.6-gentoo  (Kernel image)
options root=/dev/sdaX rw  (X = root filesystem)

Please set up two command, otherwise the volume won't work.
# rc-update add dbus default
# rc-update add xdm default

Other Work need to do

Reference:

1 則留言:

  1. 1XBet
    Betting in India. It can be great to https://septcasino.com/review/merit-casino/ find the most popular https://octcasino.com/ brands, especially ones that offer gri-go.com betting on sports such as football, tennis,  Rating: 1/10 ventureberg.com/ · ‎Review by Riku VihreasaariWhere can I 1xbet korean find 1xbet?Where can I find 1xbet betting?

    回覆刪除