Creating a Snapshot-Based Backup of Oracle Linux Database Server(Exadata)

Story: We have Exadata x5-2 servers and they must be PCI compliant. Our PCI scanner found a lot of vulnerabilities on these machines, most of them were rpm upgrades.

So we are in a hell (devil) . Exadata is not a toy and upgrading it’s system is not like playing :):)

We must backup the system , and take the image before doing such things.

Because of Exadata has LVM-s installed we can use LVM based backups.

So let’s start:

Creating a Snapshot-Based Backup of Oracle Linux Database Server with Uncustomized Partitions

This means that you have not changed anything after the initial installation.

a) create mount point where you save backups. It is better if you use NFS. But if you don’t have NFS you may temporarily use local storage and then copy backup to another disk to be more safe.

Exadata local disk is 1.6TB in size and there is about 1.4TB free , so we can create another logical volume for backup. Let’s create logical volume 400GB  in size.
Here, I can tell you the difference between DBA and Sysadmin 🙂 DBA needs more and more space and always takes more than required for being calm for next 5 years. And sysadmin is giving to DBA less space than required and everytime you ask him/her storage his/her face becomes like thinking_80_anim_gif

# lvcreate -L 400GB -n backup VGExaDb
# mkdir /backup
# mkfs.ext4 /dev/VGExaDb/backup
# echo “/dev/VGExaDb/backup     /backup                 ext4    defaults        0 0” >> /etc/fstab
# mount /backup

b) Take a snapshot-based backup of the / (root), /u01. Name them root_snap and u01_snap. Mount them to the newly created directories called exadata_os_backup and exadata_u01_backup.

# mkdir /backup/exadata_os_backup
# mkdir /backup/exadata_u01_backup
# lvcreate -L1G -s -c 32K -n root_snap /dev/VGExaDb/LVDbSys1
Logical volume “root_snap” created.
# e2label /dev/VGExaDb/root_snap DBSYS_SNAP
# mount /dev/VGExaDb/root_snap /backup/exadata_os_backup -t ext4
# lvcreate -L5G -s -c 32K -n u01_snap /dev/VGExaDb/LVDbOra1
Logical volume “u01_snap” created.
# e2label /dev/VGExaDb/u01_snap DBORA_SNAP
# mount /dev/VGExaDb/u01_snap  /backup/exadata_u01_backup -t ext4

c)  Create the backup file using the following command:

# cd  /backup
# tar -pjcvf /backup/os_backup.tar.bz2 * –exclude os_backup.tar.bz2 > /backup/os_backup.stdout 2> /backup/os_backup.stderr

Check the /tmp/backup_tar.stderr file for any significant errors. Errors about failing to tar open sockets, and other similar errors, can be ignored.

d) Unmount the snapshots and remove the snapshots for the root and /01 directories using the following commands:

umount /backup/exadata_u01_backup
umount /backup/exadata_os_backup
lvremove /dev/VGExaDb/u01_snap
lvremove /dev/VGExaDb/root_snap

More information:
There is also discussed “Creating a Snapshot-Based Backup of Oracle Linux Database Server with Customized Partitions”.


Reducing a root LVM

In this post I want to reduce root volume to free up the space for other volumes. Let’s discuss it step by step:

1. Download Linux system rescue disk such as SYSTEMRESCUECD or KNOPPIX available as a bootable CD-ROM . I prefer systemrescuecd.

Official site for systemrescuecd: . Direct download link is this.
Official site for knoppix:

2.  Boot  SYSTEMRESCUECD on start-up. This step is done because we need volume, that should be shrunk, to be unmounted. As you know root volume cannot be unmounted when the OS is running on it.

3.  Make all LVM volumes found available to the rescue kernel:

root@sysresccd ~ % lvm vgchange -a y

4. List logical volume names:

root@sysresccd ~ % ls /dev/VolGroup00/
LogVol00 LogVol01

5. Before shrinking file system , it is recommended to check file system and fix any errors:

root@sysresccd ~ %  e2fsck -f /dev/VolGroup00/LogVol00

6. After the check is successful, shrink the file system on LVM. I am reducing it to 50G.

root@sysresccd ~ % resize2fs -f /dev/VolGroup00/LogVol00 50G

7.  Re-run e2fsck.

root@sysresccd ~ %  e2fsck -f /dev/VolGroup00/LogVol00

8.  Now reduce the logical volume itself to 50G.

root@sysresccd ~ % lvm lvreduce -L50G /dev/VolGroup00/LogVol00

Note : If you want to reduce size of the volume by some value, you should use minus sign in front of the number value like : –L  -50G.

Reboot the system.