Home > LINUX and GNU > dd, tar, backup and restore. Install Grub

dd, tar, backup and restore. Install Grub

If the disk is small, can use dd to backup and restore.
dd if=/dev/sda of=./backup.img

Others backup and restore:
1, backup all files
cd to the / or destination folder and do
sudo tar -cpszf ./desfolder/desfile.tar.gz .
dd if=/dev/sda bs=8192 |gzip -c9 > partitiontable.img.gz (backup partition table, when restore, the disk will have the same partition table as the disk before backup)
dd if=/dev/sda1 bs=512 |gzip -c9 > bootblock.img.gz (backup bootblock which might be in the partition)
2, restore
dd if=/partitiontable.img of=/dev/sda it will restore the partition table.
format the partition, mkfs.ext3 /dev/sda1
restore boot block, dd if=./bootblock.img of=/dev/sda1
tar -xf desfile.tar.gz

Install Grub,
connect the usb disk on a linux system.
mount it to a folder like mnt
mount /dev/sda1 /mnt
mount -o bind /dev /mnt/dev
mount -o bind /proc /mnt/proc
chroot /mnt
grub-install /dev/sda

Categories: LINUX and GNU
  1. June 30, 2013 at 10:53 AM

    Hi, i think that i saw you visited my weblog so i came
    to “return the favor”.I am trying to find things to improve my site!
    I suppose its ok to use a few of your ideas!!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: