#3388 Issue open
: Need to create timestamped directory under NFS for backup¶
Labels: support / question
SurjithSabu opened issue at 2025-01-27 16:48:¶
Hi All,
How can i create time stamped directories under an NFS mount for rear
backup?
Please suggest on this
Thanks
SurjithSabu commented at 2025-01-28 07:29:¶
Please find the local.conf below.
i want to know that the configuration are correct or not.Could you
please suggest on this.
OUTPUT=ISO
BACKUP=NETFS
BACKUP_OPTIONS="nfsvers=4,nolock"
BACKUP_URL=nfs://
BACKUP_PROG_COMPRESS_OPTIONS=( --gzip )
BACKUP_PROG_COMPRESS_SUFFIX=".gz"
BACKUP_PROG_EXCLUDE=( '/tmp/' '/data/' )
command to trigger backup
TMPDIR="/tmp/backup${NODE}_${TIMESTAMP}"
ssh administrator@"$NODE" "sudo rear -d -v -c $TMPDIR mkbackup"
gdha commented at 2025-01-28 07:45:¶
@SurjithSabu The -c DIR
stands for "alternative config directory
instead of /etc/rear", which is the directory containing your local.conf
file. This is not the target directory of your backup images.
You can achieve this via NETFS_PREFIX=$TIMESTAMP
in your
/etc/rear/local.conf
file. As ReaR is a bash script all your variables
must be bash compliant as well. Keep this in mind. Easy to test:
bash -n /etc/rear/local.conf
SurjithSabu commented at 2025-01-29 06:13:¶
@gdha thanks for your suggestion. i'm able to perform the backup. One more thing I've noticed that the output not getting saved as .iso file. it saved as backup.tar.gz. could you please guide
SurjithSabu commented at 2025-01-29 14:47:¶
Hi @gdha ,
Could please help me to align all the files under timestamp directory.
current output has mentioned below.
can you suggest on this.
find /mnt -type f
/mnt/stg-overcloud-controller-01/.lockfile
/mnt/stg-overcloud-controller-01/rear-stg-overcloud-controller-01.iso
/mnt/stg-overcloud-controller-01/VERSION
/mnt/stg-overcloud-controller-01/README
/mnt/stg-overcloud-controller-01/rear-stg-overcloud-controller-01.log
/mnt/overcloud-backups/20250128-091714/.lockfile
/mnt/overcloud-backups/20250128-091714/backup.tar.gz
/mnt/overcloud-backups/20250128-102428/backup.tar.gz
/mnt/overcloud-backups/20250128-102428/backup.log
/mnt/overcloud-backups/20250128-102428/selinux.autorelabel
local.conf¶
OUTPUT=ISO
BACKUP=NETFS
BACKUP_URL=nfs://IPaddress/openstack_stg_backup
BACKUP_PROG_COMPRESS_OPTIONS=( --gzip )
BACKUP_PROG_COMPRESS_SUFFIX=".gz"
BACKUP_PROG_EXCLUDE=( '/tmp/' '/data/' )
NETFS_PREFIX=overcloud-backups/20250128-102428
Thanks
gdha commented at 2025-01-30 07:41:¶
You could add
OUTPUT_URL=nfs://IPaddress/openstack_stg_backup/$NETFS_PREFIX
SurjithSabu commented at 2025-02-04 17:07:¶
Hi @gdha ,
Same issue persists after adding the suggested.
i'm using the below command to modify the backup URL
Modify the local.conf with the backup URL¶
PREFIX="overcloud-backups/$TIMESTAMP"
BACKUP_URL="openstack_stg_backup/$PREFIX"
ssh admin@"$NODE" "echo NETFS_PREFIX=$PREFIX | sudo tee -a
$TMPDIR/local.conf && sudo sed -i
's|^OUTPUT_URL=.*|OUTPUT_URL=$BACKUP_URL|' $TMPDIR/local.conf" |&
tee -a "$LOG_FILE"
find /mnt -type f
/mnt/stg-overcloud-controller-01/.lockfile
/mnt/stg-overcloud-controller-01/rear-stg-overcloud-controller-01.iso
/mnt/stg-overcloud-controller-01/VERSION
/mnt/stg-overcloud-controller-01/README
/mnt/stg-overcloud-controller-01/rear-stg-overcloud-controller-01.log
/mnt/overcloud-backups/20250128-091714/.lockfile
/mnt/overcloud-backups/20250128-091714/backup.tar.gz
/mnt/overcloud-backups/20250128-102428/backup.tar.gz
/mnt/overcloud-backups/20250128-102428/backup.log
/mnt/overcloud-backups/20250128-102428/selinux.autorelabel
/mnt/overcloud-backups/20250204-085932/backup.tar.gz
/mnt/overcloud-backups/20250204-085932/backup.log
/mnt/overcloud-backups/20250204-085932/selinux.autorelabel
/mnt/overcloud-backups/20250204-094125/backup.tar.gz
/mnt/overcloud-backups/20250204-094125/backup.log
/mnt/overcloud-backups/20250204-094125/selinux.autorelabel
Thanks
gdha commented at 2025-02-06 15:49:¶
@SurjithSabu I have in my /etc/rear/local.conf
the following entries:
OUTPUT=ISO
BACKUP=NETFS
OUTPUT_PREFIX="$(hostname -s)/$(date '+%F')"
NETFS_PREFIX="$OUTPUT_PREFIX"
BACKUP_URL=nfs://nas/volume1/RearSpace
and with that is see on the NAS:
# ls -l /volume1/RearSpace/noc/2025-02-06
total 1682496
-rw------- 1 admin users 956563456 Feb 6 16:48 backup.tar.gz
-rw------- 1 admin users 202 Feb 6 16:45 README
-rw------- 1 admin users 766230528 Feb 6 16:45 rear-noc.iso
-rw------- 1 admin users 73672 Feb 6 16:45 rear-noc.log
-rw------- 1 admin users 292 Feb 6 16:45 VERSION
This should solve your problem IMHO.
[Export of Github issue for rear/rear.]