Jump to Navigation

115 - Restore Command

System administration command. Restore backed up files from a dump archiv.
Execure this command with one of the following flags.

1. Restart Rescue Mode by Installation DVD(or CDROM)

> linux rescue

* Not set up the network (skip).
* Not mount the filesystem to "/mnt/sysiamge" (skip).

Network Manual set up

# ifconfig eth0 192.168.1.xxx netmask 255.255.255.0

2. Mount an external device or NFS to access dump files.
   Ex. Like USB and so on which has dump files for restore.

 # cd /mnt
 # mkdir backup
 # mount -t nfs 192.168.10.61:/home/backup /mnt/backup

   (USB : # mount /dev/sdb2 /mnt/backup)

3. Create partitions from sfdisk information.

# sfdisk --force /dev/sda < /mnt/backup/sfdiskinfo.txt

   (# sfdisk -d /dev/sda > sfdiskinfo.txt )

4. Remove volime group, logical volume (if needs).

# lvm lvremove -f /dev/VolGroup00/LogVol00
# lvm lvremove -f /dev/VolGroup00/LogVol01

# lvm vgremove /dev/VolGroup00

To Acvivate a volume Gtoup & Logical Volumes:

# lvm vgchange -ay -P VolGroup00

5. Create Physical Volume

# lvm pvcreate /dev/sda5

6. Create Volume Group 

# lvm vgcreate VolGroup00 /dev/sda5

7. Create Logical Volume

# lvm lvcreate --size 4GB --name /dev/VolGroup00/LogVol00 VolGroup00

8. Check all logical volumes

# lvm pvscan

9. Create File System

# mke2fs -L /boot -j /dev/sda3
# mke2fs -j /dev/VolGroup00/LogVol00

10. Swap Area

  # lvcreate -n LogVol06 --size 2G VolGroup00
  # mkswap /dev/VolGroup00/LogVol06
  # swapon /dev/VolGroup00/LogVol06

11. Restore dump files

###< root dir >

# cd /mnt
# mkdir root_dir
# mount -t ext3 -o nouser_xattr /dev/VolGroup00/LogVol00 /mnt/root_dir
# cd /mnt/root_dir
# gzip -dc /mnt/backup/bkup-VolGroup00-LogVol00.gz | restore -r -T /mnt/backup -f -

###< boot >

# cd /mnt
# mkdir boot
# mount -t ext3 -o nouser_xattr /dev/sda3 /mnt/boot
# sync

    (You need to specify a file type "ext3" with the rescue mode)
   nouser_xattr : disable user extended attribute for Restore.

# cd /mnt/boot
# gzip -dc /mnt/backup/bkup_boot.gz | restore -r -T /mnt/backup -f -
# sync

 
12. Install grub, Master Boot Block

Before umount /mnt/boot, You need to mount block device files (sda*) to /mnt/root_dir/dev/ from live CD /dev/*

# mount -t proc none /mnt/root_dir/proc
# mount -o bind /dev /mnt/root_dir/dev
# umount /mnt/boot
# chroot /mnt/root_dir

 If  /boot and / in a deferent partition, grub-install command is like :

/dev/mapper/VolGroup00-LogVol00     36724544   4012160  30816756  12% /
/dev/sda1                                              101086           18115        77752  19% /boot

# grub-install /dev/sda

(or # grub-install --root-directory=/boot /dev/sda)

 

# umount /boot
# exit
# umount /mnt/root_dir/proc
# umount /mnt/root_dir/dev
# umount /mnt/root_dir
# exit  (To finish the rescure mode.)

 To reboot Linux OS

# reboot

If you have a problem on the installation of boot loader (grub-install), you have another option,
you could use an installation CD or DVD in order to install a boot loader.


Linux:


Main menu 2

Story | by Dr. Radut