User Tools

Site Tools


Create a Swap File

dd if=/dev/zero of=$SWAPFILE bs=1024 count=1048576
mkswap $SWAPFILE
chown root:root $SWAPFILE
chmod 0600 $SWAPFILE

Mount Target System For Chroot

mount /dev/sdxn $TARGET
mount -t proc proc $TARGET/proc
mount -t sysfs sys $TARGET/sys
mount -o bind /dev $TARGET/dev
mount -t devpts pts $TARGET/dev/pts/
chroot $TARGET


Refer to `df` or `mount -l`, my excludes:


Then just `tar cf` as root(-X the excludes rule file).


Boot livecd/liveusd, `cfdisk` and `mkfs`, then mount it(see instructions above) to /target. Then:

tar xf /path/to/your/backup.tar -C /target

or get backup and extract in pipe:

ssh user@host cat /path/to/your/backup.tar |tar x -C /target


# rsync -aAXvzP --delete / /target/ --exclude-from=/path/to/backup.excludes

Get UUID using `blkid` and change `/etc/fstab` of target accordingly.

If newly-installed, `chroot` into it, run `grub-install` and `update-grub`, give it a `reboot` and it would work! Else, just update UUIDs in /boot/grub/menu.lst for grub-legacy.

update-grub For Grub2

For those who doesn't have this:

grub-mkconfig -o /boot/grub/grub.cfg

Don't Stop at Grub Screen FOREVER (WTF Ubuntu)

echo "GRUB_RECORDFAIL_TIMEOUT=5" >> /etc/default/grub

Specify I/O Scheduler For Drive Specified By Partition UUID

echo "noop" > /sys/block/`readlink /dev/disk/by-uuid/$UUID|sed "s/.*\(sd[a-z]\).*/\1/"`/queue/scheduler

Install Zesty Kernel (4.9) on Xenial

echo 'deb zesty main' >> /etc/apt/sources.list.d/zesty.list
echo -e 'Package: *\nPin: release a=zesty\nPin-Priority: 100\n' >> /etc/apt/preferences.d/zesty.pref
apt-get update
apt-get install -t zesty linux-image-generic linux-generic linux-headers-generic linux-libc-dev


linux.txt · Last modified: 2017/01/21 10:27 by felixonmars