#988 Issue closed: How to restore the folder structure without data/content?

Labels: support / question, fixed / solved / done

yin747 opened issue at 2016-08-27 08:08:

Relax-and-Recover (rear) Issue Template

Please fill in the following items before submitting a new issue:

  • rear version (/usr/sbin/rear -V): Relax-and-Recover 1.17.2 / Git
  • OS version (cat /etc/rear/os.conf or lsb_release -a): Red Hat Enterprise Linux Server release 7.2 (Maipo)
  • rear configuration files (cat /etc/rear/site.conf or cat /etc/rear/local.conf): n/a
  • Brief description of the issue
    We are using local disk for rootvg and SAN disk for datavg. Is there any feature to restore the folder structure only without data/content?

If there is this feature, I don't not need to make the directory (ie: mkdir -p /appl/xxx) after restoring rootvg.

gozora commented at 2016-08-27 10:08:

Hi, not sure if if ReaR have such feature.
However I've had such requests in the past so maybe a small script of mine could be helpful:


[[ -z $1 ]] && echo Usage: ./$(basename $0) filename && exit 1


tar tvf $archive | grep ^d | while read line; do
   uperm=$(echo $line | awk '{print substr($0, 2, 3)}' | tr -d "-") 
   gperm=$(echo $line | awk '{print substr($0, 5, 3)}' | tr -d "-")
   operm=$(echo $line | awk '{print substr($0, 8, 3)}' | tr -d "-")

   owner_group=$(echo $line | awk '{print $2}')
   owner=$(echo $owner_group | awk -F "/" '{print $1}')
   group=$(echo $owner_group | awk -F "/" '{print $2}')

   filename=$(echo $line | awk '{print $NF}')

   mkdir $filename
   chmod u+$uperm $filename
   chmod g+$gperm $filename
   chmod o+$operm $filename
   chown $owner:$group $filename

Please be aware that it does not restore directory modification dates ...


gdha commented at 2016-08-29 09:45:

@yin747 in rear-1.18 that issue has been fixed where all mount point directories (incl permissions) were saved into a file ($VAR_DIR/recovery/mountpoint_permissions) via script /usr/share/rear/prep/default/40_save_mountpoint_details.sh

jsmeix commented at 2016-09-21 13:49:

According to https://github.com/rear/rear/issues/988#issuecomment-243080955
the issue is fixed (in rear 1.18).

[Export of Github issue for rear/rear.]