-- Regards, Richard Jackson George Mason University UNIX Systems Engineer UCIS / ISO Computer Systems Engineering Andy Phillips writes: > From alpha-osf-managers-relay_at_sws1.ctd.ornl.gov Wed Jun 14 15:39:10 1995 > Sender: alpha-osf-managers-relay_at_sws1.ctd.ornl.gov > From: Andy Phillips <atp_at_mssly1.mssl.ucl.ac.uk> > Reply-To: Andy Phillips <atp_at_mssly1.mssl.ucl.ac.uk> > Message-Id: <9506141423.AA16058_at_mssly3.mssl.ucl.ac.uk> > Followup-To: poster > Subject: SUMMARY: restoring ADVfs quota files from backup > To: alpha-osf-managers_at_ornl.gov > Date: Wed, 14 Jun 1995 15:23:26 +0100 (BST) > X-Mailer: ELM [version 2.4 PL23] > Mime-Version: 1.0 > Content-Type: text/plain; charset=ISO-8859-1 > Content-Transfer-Encoding: 7bit > Content-Length: 1959 > > Summary re: restore of quota files. > > The quick answer is that it cant be done. > > precis of problem. > I have backed up on tape a set of user directories and their > appropriate quota files. > A disk is lost/reconfigured, forcing a remake of the ADVfs file > domain. Restoring the data to the individual filesets is not a > problem, however, the quota files cannot be overwritten. > Whilst the userquota and groupquota options to the mount command > or in fstab allow the redirection of the quota querying tools > (like repquota) to alternate filenames, the filesystem still maintains > tracking information in the files occupying i-node 4 and 5. (the > default quota.user and quota.group.) > > result. > Despite the best efforts of several very bright and experienced > unix administrators in a "can you delete this file" competition, the > advfs remained resolute in its defiance. The fundamental problem > appears to be that even when mounted without quotas enabled, the ADVfs > maintains this information anyway. The silver lining here is the > proof of the filesystems' robustness.... > > Eventually i gave up and re-entered all the quota information by > hand. > > Replies from various list-members indicated similar problems. My > heart (or rather my fingers) goes out to the poor soul who had to > do this for > 13,000 users. The feature of restoring quota information > from backups will apparently not appear in vn 4.0 either. > > Thanks go to; > > Knut.Hellebo_at_nho.hydro.com > Stuart 'Zen' Bishop <zen_at_RMIT.EDU.AU> > Saul Tannenbaum <stannenb_at_emerald.tufts.edu> > "Richard L Jackson Jr" <rjackson_at_portal.gmu.edu> > > andy > > -- > atp_at_mssly1.mssl.ucl.ac.uk Andy Phillips > atp_at_mssl.ucl.ac.uk Mullard Space Science Laboratory, > phillips_at_isass1.solar.isas.ac.jp Dept. Space and Climate Physics, > mssly1::atp University College London. > It is true that no Digital UNIX solution exists to rebuild AdvFS user quotas. However, we have a large user base and were forced to rebuild user quotas several times; accidental disk init, failed disk, and moving a filesystem to another disk. Therefore, the following tools were developed... 1. modify the dump process to execute vrepquota for each dumped filesystem and save a copy of the report prior to the actual dump. 2. develop ksh tool to process vrepquota report to reconstruct user quotas 3. develop C tool to actually set the quota ps. Could the crack AdvFS development team add this feature to Digital UNIX? While they are considering this issue, perhaps they will consider the following; 1. vrestore should support -s to skip dumpsets and/or make mt available in /sbin. I had to restore /usr from mini-root and had difficulty to restore dumpsets on a multiple dumpset tape. 2. vrestore should not use /tmp. I could not restore /usr after booting from CD-ROM (mini-root) since vrestore required more space in /tmp than / had available. I had to make and mount a real /tmp partition to restore /usr. Not good. Perhaps vrestore should use the filesystem it is restoring. I think UFS restore uses this method and creates a file named restoresymtable. 3. /sbin/init.d/vquota? There isn't one. Currently customers have to either write their own script to support AdvFS quotas or do it manually. 4. make AdvFS truly SMP. Anyways, the tools... ----------------------------- begin dump tool ------------------------------- #!/sbin/sh ######################################################################## # # # NAME: dumpfull.sh # # # # PROGRAMMER: Richard Jackson, rjackson DATE: 940601 # # # # PURPOSE: Full dump of AdvFS filesystems. Save quota information # # since OSF/1 3.0 vrestore does not restore user quota # # limits. # # # # NOTES: # # to execute: # # 1. dumpfull.sh # # # # # # MODIFICATION HISTORY: # # DATE MOD NAME DESCRIPTION # # # # 950203 AAA rjackson initial version # # 950206 AAB rjackson add date info to log # # 950212 AAC rjackson add code to save user quota limits. # # OSF/1 3.0 actually does not dump/save # # the quota.user and quota.group files on # # tape. # # 950320 AAC rjackson set dump to higher priority to reduce # # dump context switches. Also, remove # # code to save quota.* files. Continue # # to save quota report file. # # # ######################################################################## # umask 077 FSTAB=/etc/fstab DATE=`/usr/bin/date '+%y%m%d'` LOG=/var/adm/dump/dumpfull.$DATE AWK=/usr/bin/awk CHMOD=/usr/bin/chmod CHOWN=/sbin/chown CP=/sbin/cp FGREP=/usr/bin/fgrep LPR=/usr/bin/lpr MT=/usr/bin/mt NICE=/bin/nice RM=/sbin/rm TEE=/usr/bin/tee VDUMP=/sbin/vdump VREPQUOTA=/usr/sbin/vrepquota $RM -f $LOG while read REC do ftype=`echo $REC | $AWK '{print $3}'` fsystem=`echo $REC | $AWK '{print $2}'` if [ "${ftype}x" = "advfsx" -a "${fsystem}x" != "/tmpx" ] then QRPT=${fsystem}/quota.report $VREPQUOTA $fsystem > $QRPT $CHMOD 640 ${QRPT} $CHOWN root.operator ${QRPT} $NICE -n -10 $VDUMP 0uf /dev/nrmt0h ${fsystem} 2>&1 | $TEE -a $LOG $RM ${QRPT} fi done < $FSTAB $CHMOD 644 $LOG $LPR -Pportrait -N4 $LOG $MT -f /dev/rmt0h offline ----------------------------- end dump tool ------------------------------- ----------------------------- begin ksh tool ------------------------------- #!/bin/ksh ######################################################################## # # # NAME: fixvquota.ksh # # # # PROGRAMMER: rjackson DATE: 950328 # # # # PURPOSE: Set the quota, using fixvquota, for users specified in # # OSF/1 3.2a vrepquota report output. # # # # vrepquota output format: # # # # Block limits File limits # #User used soft hard grace used soft hard grace# #root -- 123 0 0 19 0 0 # #rjackson -- 1449 2000 2500 160 0 0 # # # # NOTES: # # to execute: # # 1. fixvquota.ksh /usr/u1 < vrepquota.out # # # # where /usr/u1 is the filesystem to rebuild user quotas. # # # # MODIFICATION HISTORY: # # DATE MOD NAME DESCRIPTION # # # # 950328 AAA rjackson initial version # # # ######################################################################## # umask 027 AWK=/usr/bin/awk FIXVQUOTA=/usr/local/system/fixvquota FILESYSTEM=$1 # # skip first two vrepquota headers. # read REC read REC while read REC do USER=`echo $REC|$AWK '{print $1}'` SOFT=`echo $REC|$AWK '{print $4}'` HARD=`echo $REC|$AWK '{print $5}'` $FIXVQUOTA $USER $SOFT $HARD $FILESYSTEM done # main while loop exit 0 ----------------------------- end ksh tool ------------------------------- ----------------------------- begin C tool ------------------------------- /**********************************************************************/ /* */ /* NAME: fixvquota.c */ /* */ /* PROGRAMMER: Richard Jackson DATE: 950328 */ /* */ /* PURPOSE: Set the quota for a specified user on a specified */ /* filesystem. This routine's purpose is to compensate for */ /* vdump/vrestore commands not restoring AdvFS user quotas. */ /* */ /* NOTES: */ /* To execute: */ /* 1. fixvquota username softlimit hardlimit filesystem */ /* for example, */ /* ./fixvquota jblow 2000 2500 /var/spool/mail */ /* */ /* To build under OSF/1 3.x: */ /* 1. cc -O -non_shared -om -o fixvquota fixvquota.c */ /* 2. strip fixvquota */ /* */ /* Only root can successfully run this program. */ /* */ /* */ /* MODIFICATION HISTORY: */ /* DATE MOD NAME DESCRIPTION */ /* */ /* 950328 AAA rjackson initial version */ /* */ /**********************************************************************/ #include <stdio.h> /* printf() */ #include <pwd.h> /* getpwnam() */ #include <stdlib.h> /* atoi(), exit() */ #include <sys/types.h> #include <ufs/quota.h> /* quotactl() */ #include <sys/mount.h> /* statfs() */ #include <errno.h> /* perror() */ #include <unistd.h> /* geteuid() */ main (int argc, char *argv[]) { struct dqblk dqblk_st; /* disk quota structure */ struct passwd *pw; /* passwd file entry structure */ u_int softlimit; /* quota soft limit */ u_int hardlimit; /* quota hard limit */ struct statfs statfs_st; /* mounted filesystem info */ uid_t uid; /* user id */ /* * make sure we have the required arguments */ if (argc != 5) { fprintf(stderr, "Usage: fixvquota username softlimit hardlimit filesystem\n" ); exit(1); } /* * this program requires root */ if ( geteuid() != (uid_t) 0) { fprintf(stderr, "%s: you must be root\n", argv[0]); exit(1); } /* * does this user exist in the /etc/passwd file? */ if ((pw = getpwnam(argv[1])) == (struct passwd *) NULL) { fprintf(stderr, "%s: can't find passwd entry for %s\n", argv[0], argv[1]); exit(1); } /* * check if quota's are valid for the specified filesystem */ if (statfs(argv[4], &statfs_st, sizeof(struct statfs))) { fprintf(stderr, "%s: statfs() failed, errno=%d\n", argv[0], errno); exit(1); } /* * Filesystem should manage quotas or be AdvFS (i.e., AdvFS always * manages quotas). M_QUOTA appears to not be set for AdvFS. */ if (!((statfs_st.f_flags & M_QUOTA) || (statfs_st.f_type == MOUNT_MSFS))) { fprintf(stderr, "%s: quota is not enabled for %s filesystem", argv[0], argv[4]); exit(1); } /* * fetch current values */ if (quotactl(argv[4], QCMD(Q_GETQUOTA, USRQUOTA), pw->pw_uid, &dqblk_st)) { fprintf(stderr, "%s: quotactl() GETQUOTA failed, errno=%d\n", argv[0], errno); exit(1); } softlimit = atoi(argv[2]); hardlimit = atoi(argv[3]); /* * disk blocks (512 bytes each) times 2. vquota reports number of 1024 * byte blocks. */ dqblk_st.dqb_bsoftlimit = softlimit * 2; dqblk_st.dqb_bhardlimit = hardlimit * 2; /* * set new quotas */ if (quotactl(argv[4], QCMD(Q_SETQUOTA, USRQUOTA), pw->pw_uid, &dqblk_st)) { fprintf(stderr, "%s: quotactl() SETQUOTA failed, errno=%d\n", argv[0], errno); exit(1); } exit(0); } ----------------------------- end C tool -------------------------------Received on Thu Jun 15 1995 - 16:01:01 NZST
This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:45 NZDT