option to copy quota information in Cluster Users and Groups

Hi, I am using virtualmin pro in 2 servers and for the sake of having a backup server I frequently use module Cluster Users and Groups to add missing users and groups.

However, the quotas applied on one server are not copied on the other server so I have to change them manually.

Could you add an option to Cluster Users and Groups to replicate quotas as well? I intend to use it in a script so it would be very helpful if you could add an option to the corresponding script also, so that I could call it from command line?

Thanks in advance!

Status: 
Closed (fixed)

Comments

I wouldn't really recommend using Cluster Users and Groups for this kind of replication .. why not instead make use of Virtualmin's backup and restore capabilities?

You could backup all your domains on the master system, and restore them on the target. If home directories are shared between the two (perhaps via NFS), you could choose to not include home directory contents in the backups.

I see your point.

I am doing an initial backup restore from restore-domain.pl through a command line script.

I had some problems in that script regarding restore of dns and that's what's keeping me from using this procedure for synchronizing users as well.

I wanted to exclude dns setup from restoring on the backup server since the domain in the backup server was already setup as secondary dns. The option --except-feature dns on restore-domain.pl didn't work. It checked if the domain was already served by dns and stopped with an error

I had to comment named.conf.local through sed on each server to make the restore and then use the previous named.conf.local I had taken backup before the restore. I don't really want to do this kind of actions for synchronizing users as well. If you can fix --except-feature dns I can try it and maybe this is better.

So

1) I would be happy if --except-feature dns continues without checking anything or restoring anything for dns and this might solve my situation.

2) And I leave as a proposal enhancing Cluster Users and Groups to synchronizing also quota if you think it might be useful

3) And a quick question. Is there a way to check from command line from one of your scripts in /usr/share/webmin/cluster-useradmin, the way you check if users are in sync in the web interface, so that I can take actions only if users are not synchronized?

Thanks!

One option that might help in your case is the --only-features flag, which will not enable or restore features that you disable, such as DNS. Let us know if that helps ..

This is what I did

Backing up from one server

/usr/share/webmin/virtual-server/backup-domain.pl --dest /backup/virtualmin/test-dom.gr.tar.gz --domain test-dom.gr --all-features --except-feature dns --except-feature mail --except-feature mysql --except-feature dir
Starting backup..
Creating backup for virtual server test-dom.gr ..


    Copying virtual server configuration ..
    .. done

    Backing up Cron jobs ..
    .. none defined.

    Copying Apache virtual host configuration ..
    .. done

    Copying Webalizer configuration files ..
    .. done

    Copying Logrotate configuration ..
    .. done

    Backing up Webmin ACL files ..
    .. done

    Backing up AWstats configuration file ..
    .. done

Creating final backup archive ..
.. done

1 servers backed up successfully, 0 had errors.

Backup completed successfully. Final size was 30.55 kB

I assume that this excludes dns, mysql, postfix and files. Am I correct?

I am trying to use the only-features flag to restore

/usr/share/webmin/virtual-server/restore-domain.pl --source /backup/virtualmin/test-dom.gr.tar.gz --domain test-dom.gr --feature ftp --feature logrotate --feature status --feature unix --feature webalizer --feature webmin --feature web --only-features --no-reuid
Checking for missing features ..
.. all features in backup are supported

Starting restore..
Extracting backup archive file ..
.. done

Restoring backup for virtual server test-dom.gr ..
Error: setquota: user test-dom does not exist.

-----
setquota: user test-dom does not exist.

What went wrong? Am I not restoring a feature? I don't know though where to find the short names of all features. I saw some scripts like feature-dir.pl so I used these short names. Can you provide me with a list or a suggestion where to search.

For the backup, you can include all features if you like .. but including only those you want to replicate is also OK.

For the restore error, does the target system have disk quotas enabled? If so, does a Unix user named test-dom exist in the /etc/passwd file?

The target system didn't have a user test-dom because I wanted him to be created by the script.

I added --feature dir and now it creates user as well.

/usr/share/webmin/virtual-server/restore-domain.pl --source /backup/virtualmin/test-dom.gr.tar.gz --domain test-dom.gr --feature dir --feature ftp --feature logrotate --feature status --feature unix --feature webalizer --feature webmin --feature web --only-features --no-reuid

I think this command Is good for initial restore

Now I change plan on the domain on the master server, add a user and then take a full backup

Trying to restore with the same command adding --feature ftp --feature mail --feature virtualmin

/usr/share/webmin/virtual-server/restore-domain.pl --source /backup/virtualmin/test-dom.gr.tar.gz --domain test-dom.gr --feature dir --feature ftp --feature logrotate --feature status --feature unix --feature webalizer --feature webmin --feature virtualmin --feature web --feature ftp --feature mail --only-features --no-reuid
Checking for missing features ..
.. all features in backup are supported

Starting restore..
Extracting backup archive file ..
.. done

Restoring backup for virtual server test-dom.gr ..
    Extracting TAR file of home directory ..
    .. done

    Setting ownership of home directory ..
    .. done

    Restoring Logrotate configuration ..
    .. done

    Updating administration password and quotas ..
    .. done

    Restoring Cron jobs ..
    .. done

    Restoring Webalizer configuration files and Cron job ..
    .. done

    Restoring Webmin ACL files ..
    .. done

    Restoring Apache virtual host configuration ..
    .. done

    Checking restored PHP execution mode ..
    .. mode Apache mod_php OK for this system

    Re-creating mail and FTP users ..
    .. done

    Re-creating mail aliases ..
    .. done

    Restoring mail and FTP user Cron jobs ..
    .. done

    Updating Webmin user ..
    .. done

Applying web server configuration ..
.. done

Re-loading Webmin ..
.. done

Restore completed successfully.

Everything is OK

This one worked also to apply changes (as a second restore not as a first)

/usr/share/webmin/virtual-server/restore-domain.pl --source /backup/virtualmin/test-dom-s2.gr.tar.gz --domain test-dom-s2.gr --all-features --except-feature dir --except-feature dns --except-feature mysql --no-reuid

Excellent!

I tried dir feature to apply quotas and that worked and guessed there might be a feature virtualmin which also changed the plan, but I would like some directions on where to find more info.

Is there anywhere a full list of supported short feature names and any help on what they do?

Thanks for all replies!

Cool, glad you got that working.

You can find a list of feature codes from the command virtualmin list-features

Does that answer all your questions?

Yes, thank you very much!

Cool, I will mark this bug as fixed then.

Automatically closed -- issue fixed for 2 weeks with no activity.