≡ Menu

Linux and Unix Backup and Restore

Tutorials, howtos, and general Linux / Unix tips about Backing and restoring the systems. This section guides sys admin with backing up data to enable recovery from data loss. ( rss feed )

Q. Can I use RAID as the only backup solution under Linux? Is RAID is reliable backup solution for server?
[click to continue…]

Q. How do I fix the following error under CentOS Enterprise Linux:

LVM error VG meta data inconsistent

How do I fix this problem?

A. You need to use lvm command, which provides the command-line tools for LVM2. In order to fix this problem boot your Linux into rescue mode or a single user mode:

First, you need to restore the VG Meta data, enter:
lvm vgcfgrestore VG

Now, you need to rescan for physical devices and vol groups (scan all disks for physical volume), enter:
lvm pvscan
lvm vgscan

Finally, make the volume group active, enter:
lvm vgchange -ay VG

For more information read lvm man page:
man lvm

Q. How do I use rsync command to back up a home directory under Linux operating system?

A. rsync command easily backup your home directory to local secondary hard disk or remote server using ssh protocol. rsync is a software application for Unix systems which synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate.

Task: Backup /home/tom to /mnt/usbpen

Assuming that USB pen or external USB hard disk is mounted at /mnt/usbpen, enter the following command to backup (sync) new files and changes to existing files but don't remove files in backup directory:
$ rsync -au /home/tom /mnt/usbpen
To delete files in backup directory that no longer exist in directory being backed up, enter:
$ rsync -au --delete /home/tom /mnt/usbpen

See our previous article about using rsync for transferring files under Linux or UNIX from local or remote network computer.

I'd like to configure my Debian box to backup two remote servers using rsnapshot software. It should make incremental snapshots of local and remote filesystems for any number of machines on 2nd hard disk located at /disk1 ( /dev/sdb2).
[click to continue…]

How do I create a tar file under Linux using command line options?
[click to continue…]

How can I keep out certain files when creating a tarball? For example:


How do I exclude zyz and abc file while using a tar command?
[click to continue…]

Q. I made MySQL backup using mysqldump -u user -h localhost -ppassword forumdb | -gzip -9 > forumdb.sql.gz command. How do I restore MySQL database backup using a shell prompt under Linux / UNIX operating system?
[click to continue…]