Today I needed to archive every non-hidden directory in several different locations. I do not like to repeat myself so after a while I quickly created shell script to accomplish this task.
Tag: Backup
If you ever wanted to create bootable recovery USB Flash Drive then I have good news for you as it can be achieved in several simple steps using Clonezilla Live CD, external USB Hard Drive, and a target USB Flash Drive.
Today I will describe how to use rsync over ssh using four simple examples as it is very convinient way to perform secure and automated backup.
A couple of months ago, I published a short script to backup MySQL databases. Today I created a simple shell script to backup selected directories.
Simple shell script to backup MySQL databases.
This is just a short note, more information can be found directly at the MikroTik Wiki – Automated Backups.
DOS partition table
We can use sfdisk to dump partition table in usable format and store it:
$ sudo sfdisk -d /dev/sda > sda_partitions
Partition table can be restored using stored backup:
$ sudo sfdisk /dev/sda < sda_partitions
Partition table can be easily cloned (from sda to sdz in this example):
$ sudo sfdisk -d /dev/sda | sfdisk /dev/sdz
GPT
To backup GUID partition table use sgdisk command (from gdisk package):
$ sudo sgdisk -b sda_gpt_backup /dev/sda
Restore it in similar way:
$ sudo sgdisk -l sda_gpt_backup /dev/sda
LVM
To backup LVM metadata for volume group vol_test to vol_test_backup file use command:
$ sudo lvm vgcfgbackup -f vol_test_backup vol_test
To restore volume group metadata use similar command:
$ sudo lvm vgcfgbackup -f vol_test_backup vol_test
To restore physical volume metadata (with specified UUID to /dev/sda1 device):
$ sudo pvcreate --restorefile vol_test_backup --uuid rRD... /dev/sda1
There is a little more work to be done in this case (beyond this short post) so jump directly to Red Hat – Logical Volume Manager Administration.
VirtualBox command-line interface (VBoxManage) provides an easy way to convert the raw disk image to the VDI/VMDK format and otherwise.