Enhancement #2022

Backup data: do not check for already mounted dir

Added by Giacomo Sanchietti about 8 years ago. Updated almost 8 years ago.

Status:CLOSEDStart date:
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:nethserver-backup-data
Target version:v6.4-beta2
Resolution: NEEDINFO:No

Description

In pre-backup-data event there are script to mount destination backup directory.
If destination backup is already mounted, the backup will fail.

Desired behavior:
  • if directory is already mounted, continue with backup
  • if directory can't be mounted, raise an error and block backup

Related issues

Related to NethServer 6 - Enhancement #2024: Backup data: implement retention policy CLOSED
Related to NethServer 6 - Enhancement #2043: Backup: implement and document full restore CLOSED

Associated revisions

Revision 49b2f2f4
Added by Giacomo Sanchietti about 8 years ago

mount actions: skip already-mounted directory checks. Refs #2022

Revision 54049e0b
Added by Giacomo Sanchietti about 8 years ago

spec: spec: Release 1.0.2 Refs #2024 #2023 #2022

Revision 296af11e
Added by Giacomo Sanchietti about 8 years ago

mount-usb: exit with error if USBLabel is not set, check if USB disk is mounted on right directory. Refs #2022

Revision a5fa40aa
Added by Giacomo Sanchietti about 8 years ago

mount-usb: do not exit with error if USBLabel is not set and VFSType is not usb. Refs #2022

History

#1 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from NEW to TRIAGED
  • % Done changed from 0 to 20

All checks on already mounted directory can be safely removed.

#2 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from TRIAGED to ON_DEV
  • % Done changed from 20 to 30

#3 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from ON_DEV to MODIFIED
  • % Done changed from 30 to 70

Fix applied.

#4 Updated by Giacomo Sanchietti about 8 years ago

  • Assignee set to Giacomo Sanchietti

#5 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from MODIFIED to ON_QA
  • % Done changed from 70 to 80
Package ready in testing repository:
  • nethserver-backup-data-1.0.2

#6 Updated by Davide Principi about 8 years ago

  • Assignee deleted (Giacomo Sanchietti)

ON_QA: Assignee reset

#7 Updated by Davide Principi about 8 years ago

  • Assignee set to Davide Principi

#8 Updated by Davide Principi about 8 years ago

  • Status changed from ON_QA to ON_DEV
  • Assignee deleted (Davide Principi)
  • % Done changed from 80 to 30

REJECTED

Installed RPMs

    # rpm -qa | grep -F .ns6
nethserver-php-1.1.0-1.ns6.noarch
nethserver-smartd-1.0.0-1.ns6.noarch
nethserver-backup-data-1.0.4-1.ns6.noarch
nethserver-yum-1.1.0-1.ns6.noarch
nethserver-base-1.3.0-1.ns6.noarch
nethserver-nethgui-1.2.1-1.ns6.noarch
nethserver-httpd-admin-1.0.4-1.ns6.noarch
nethserver-grub-1.0.1-1.ns6.noarch
nethserver-openssh-1.0.2-1.ns6.noarch
nethserver-backup-config-1.0.3-1.ns6.noarch
nethserver-lib-1.1.2-1.ns6.noarch
postfix-2.9.6-2.ns6.x86_64
nethserver-ntp-1.0.4-1.ns6.noarch

Tested with:
  • Never delete old files
  • Mail notifications to external address
  • Report ALWAYS
  • Full backup
Cases:
  • NFS
    1. With device already mounted on dir different from /mnt/backup => PASS
    2. With device already mounted in /mnt/backup => PASS (also unmounted after backup)
  • USB
    1. With device already mounted on dir different from /mnt/backup it reported SUCCESS but files were written into mountpoint dir /mnt/backup => REJECTED
    2. With device already mounted in /mnt/backup => PASS (also unmounted after backup)
    3. Without any device attached same as point 1 => REJECTED
    4. With device attached => PASS
  • CIFS
    1. Without mount => PASS
    2. With device already mounted on dir different from /mnt/backup it reported an ERROR "Backup directory is not mounted" => PASS
    3. With device already mounted in /mnt/backup => PASS (also unmounted after backup)

Notes
Mounted dirs should be excluded from the backup (--exclude-other-filesystems arg to duplicity)

#9 Updated by Giacomo Sanchietti about 8 years ago

  • Assignee set to Giacomo Sanchietti

#10 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from ON_DEV to MODIFIED
  • % Done changed from 30 to 70
  1. With device already mounted on dir different from /mnt/backup it reported SUCCESS but files were written into mountpoint dir /mnt/backup => REJECTED

Added a test to check if USB disk is mounted on right directory (this case should not ever happen).

  1. Without any device attached same as point 1 => REJECTED

Added a check on USBLabel.

Notes
Mounted dirs should be excluded from the backup (--exclude-other-filesystems arg to duplicity)

Some users have home directories (or ibays) mounted on a separate device like a NAS. We canno't introduce this option without a way to disable it.

Needed rebuild of packages:
  • nethserver-backup-config
  • nethserver-backup-data

#11 Updated by Giacomo Sanchietti about 8 years ago

Other changes in this package:
  • attach log on notification for nethserver-backup-data
  • force esclusions berfore inclusions

#12 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from MODIFIED to ON_QA
  • Assignee deleted (Giacomo Sanchietti)
  • % Done changed from 60 to 70
New packages in nethserver-testing:
  • nethserver-backup-data-1.0.5
  • nethserver-backup-config-1.0.4

#13 Updated by Davide Principi about 8 years ago

  • Assignee set to Davide Principi

#14 Updated by Davide Principi about 8 years ago

  • Status changed from ON_QA to VERIFIED
  • Assignee deleted (Davide Principi)
  • % Done changed from 70 to 90

VERIFIED

Cases:

  • USB
    1. With device already mounted on dir different from /mnt/backup => see NOTE
    2. With device already mounted in /mnt/backup => PASS
    3. Without any device attached => PASS
    4. With device attached with USBLabel set => PASS
    5. With device attached but no USBLabel set, error => PASS

NOTE:
I've mounted the device under /root/ext and duplicity enters an infinite loop, trying to backup its own backup set. Ok, this case should never happen. We can file an enhancement in the future.

#15 Updated by Giacomo Sanchietti about 8 years ago

  • Status changed from VERIFIED to ON_QA
  • % Done changed from 90 to 70

The event pre-backup-data fails if USBLabel is not set and VFSType is not usb.

Fix:

diff --git a/root/etc/e-smith/events/actions/mount-usb b/root/etc/e-smith/events/actions/mount-usb
index cf00e9b..50bdd78 100755
--- a/root/etc/e-smith/events/actions/mount-usb
+++ b/root/etc/e-smith/events/actions/mount-usb
@@ -33,13 +33,13 @@ sub ldie;

 my $confdb = esmith::ConfigDB->open;
 my $backupwk = $confdb->get('backup-data') or die "No backup-data db entry found\n";
-my $usblabel = $backupwk->prop('USBLabel') || die "No USBLabel set";
 my $VFSType = $backupwk->prop('VFSType') || 'UNKNOWN';
 our $mntdir = $backupwk->prop('Mount') || '/mnt/backup';
 my $err = 0;
 my $mntdone = 0;

 exit 0 unless ($VFSType eq 'usb');
+my $usblabel = $backupwk->prop('USBLabel') || die "No USBLabel set";

 our $b = new NethServer::BackupData();

Changelog:

* Tue Aug 06 2013 Giacomo Sanchietti <giacomo.sanchietti@nethesis.it> - 1.0.6-1.ns6
- Do not raise error on empty USBLabel if VFSType is not usb #2022

New rpm in nethserver-testing:
  • nethserver-backup-data-1.0.6-1

Can be marked as VERIFIED: fix has been tested on a production system.

#16 Updated by Filippo Carletti almost 8 years ago

Davide Principi wrote:

NOTE:
I've mounted the device under /root/ext and duplicity enters an infinite loop, trying to backup its own backup set. Ok, this case should never happen. We can file an enhancement in the future.

It seems unlikely. I couldn't reproduce the behaviour you observed.

#17 Updated by Davide Principi almost 8 years ago

Filippo Carletti wrote:

It seems unlikely. I couldn't reproduce the behaviour you observed.

I confirm that. If the USB device is already mounted under /root/ext the duplicity process continues until the device space is exhausted.

In the normal case (that is the device is NOT mounted under /root/ext) the process completes in a few seconds and the final backup size is 736KB.

#18 Updated by Davide Principi almost 8 years ago

Davide Principi wrote:

If the USB device is already mounted under /root/ext the duplicity process continues until the device space is exhausted.

My USB drive contains 750MB data / 1,3GB free

#19 Updated by Davide Principi almost 8 years ago

  • Status changed from ON_QA to VERIFIED
  • % Done changed from 70 to 90

#20 Updated by Davide Principi almost 8 years ago

Packager note
Wait for #2043 verification

#21 Updated by Davide Principi almost 8 years ago

  • Status changed from VERIFIED to CLOSED
  • % Done changed from 90 to 100

In nethserver-updates:
nethserver-backup-config-1.0.4-1.ns6.noarch.rpm
nethserver-backup-data-1.0.6-1.ns6.noarch.rpm

Also available in: Atom PDF