LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Need help with a backup script and mounting a volume under AWS Linux (https://www.linuxquestions.org/questions/linux-software-2/need-help-with-a-backup-script-and-mounting-a-volume-under-aws-linux-4175620793/)

howarddavidp 01-03-2018 10:36 AM

Need help with a backup script and mounting a volume under AWS Linux
 
Hello,

I am new, want to first say hello. Yes, I read the newbie forum and the 2 posts, I guessed this was the best place to post. Not to offer a bounty, but if the folks here help me get my butt out of a sling, count me in for an annual membership :)

So, my question revolves around a backup script for Tenable Security Center. The script is not really the problem, but rather the volume and the placement of the tarball backup file. The script gerernates a tarball with this command:

tar -Pzvcf sc_backup.tar.gz /opt/sc

However, the application is installed to the root of /dev/xvdf, which maps to /opt/sc. (2TB of space for 234GB worth of data files)

When I do a "ls" of /opt/sc, the files and directories are installed there (I did not do the install, it is AWS linux install. I assume the virtual volume I was given is called XVDF, from reading the /dev folder.) This volumes is 2 TB in size, and it is using 234GB.

I ran a "df -h" command, and it returned:

Filesystem Size Used Avail Use% Mounted On
/dev/xvda2 100G 2.0G 99G 2% /
tmpfs 32G 0 32G 0% /dev
"a few other temps"
/dev/xvdf 2.2T 234G 1.8T 12% /opt/sc

So my dilema is I do not have the space to run this backup, because it seems the app is installed into the root of the volume with the space. No, I cannot re-install the app into the proper directory easily (it would require me to involve several others and it will take lots of effort).

I though maybe I could modify the "tar" command to exclude a directory that I would make under /opt/sc, so I make something like /opt/sc/backup, then tell tar to backup everything under /opt/sc EXCEPT the /opt/sc/backup folder. This might be the easiest way.

My other thought was to make an /opt/sc/backup folder, mount it under /backup, then again exclude it from the tar command. I am not sure what this gets me if I can figure out how to exclude /opt/sc/backup folder?

Of course, if there are other, better options, that is why I came here.

The complete script, in case anyone want to see it, is as follows:

# Tenable Console backup script
# This will make the backup file in the /backup.space #
# directory
service SecurityCenter stop
ps -fu tns
killall -u tns
killall httpd
mkdir /backup.space
cd /backup.space
tar -Pzvcf sc_backup.tar.gz /opt/sc
tar -tvf sc_backup.tar.gz



Many thanks in advance, I hope I found the best place to get some help. I have used Linux for years, on and off, then on, then off again, etc. Looks like I will be doing more and more, so I am looking for some help going forward.

TY VVM,

Dave Howard

dpajares 01-03-2018 02:43 PM

Hi all. Do you try with -C option (man tar). I recommend to read this post, maybe is a permission problem

https://stackoverflow.com/questions/...ory-permission

Can you give us the output of the -vv tar command.

Regards,

_roman_ 01-03-2018 02:52 PM

I used for a very short time rdiffbackup or what it is called. (you may use any rsync based software for that, there should be many choices available)
it allows to exclude certain folders which makes sense

I only backup from a dead system. Rephrased I boot up sysrescue live-cd to handle my not in use /
I think backup from a live running system is a bit problematic.

howarddavidp 01-05-2018 09:03 AM

Not found an answer yet
 
Hello,

We do not have the option to boot to something else and then run a backup, this is AWS linux and we are limited.

The best I have found using the man pages, is to use the --exclude='folder' option in the beginning of the tar command. I am going to test it on another folder with less data first to see if it works.

The other option, which I prefer, would be to mount the xvdf volumes at /opt, then makes a /opt/sc folder and a /opt/backup folder. I could then backup one to the other and not have to exclude anything. Problem is getting the admin to help do this, and I would also need to change how the mounting would work when it reboots, which I am not sure how to do?

Any other suggestions, other than RTFM?

Thanks,
Dave

Habitual 01-05-2018 09:27 AM

https://www.linuxquestions.org/quest...nd-aws-809188/ may offer some help.

I utilize an s3 mount for my backups using s3fs
Code:

s3fs          fuse.s3fs  256T    0  256T  0% /backups
Notoriously s.l.o..w., But...it works.

my /etc/fstab:
Code:

s3fs#internal                  /backups        fuse        allow_other,nonempty        0        0
https://cloud.netapp.com/blog/amazon...-a-file-system discusses the technique for implementing s3fs.
and https://www.interserver.net/tips/kb/...tu-using-s3fs/

Good Luck, and Happy New Year!

voleg 01-06-2018 06:45 AM

As you use AWS, do backup directly to S3, it will be cheaper.
Code:

# aws s3 sync --delete /path/to/directory/to/backup s3://your-bucket-name/
You can make it in very secure way, even encrypted at rest.
You can configure bucket for versioning, this will simulate snapshots.
In this case, do not forget to configure expiration, otherwise you will billed for extra space.


All times are GMT -5. The time now is 03:57 PM.