📄 howto
字号:
egrep -i '(eject|offl|unload)' /usr/include/sys/*.hOn Linux also try /usr/include/linux/*.h and /usr/include/asm/*.h.You should find macros defined in headers with names giving hintsto several kinds of devices. Look into the header, whether themacros could be used with the ioctl system call. The commentsshould tell details. Then you can eject the media with thefollowing code fragment:#include <sys/ioctl.h>#include <your_device_related_header>{ int res, fd; char *devicefile = "/dev/whatever"; fd = open(devicefile, O_RDONLY); if(fd < 0){ /* catch error */ ... } res = ioctl(fd, YOUR_EJECT_MACRO); if(res < 0){ /* catch error */ ... } close(fd);}You might want to extend the utility obtainable via ftp from:ftp://ftp.zn.ruhr-uni-bochum.de/pub/Linux/eject.c and relatedfiles. Please send me any success news. Thanks !--------------------------------------------------------------------------4. How to use several streamer devices on one machine ?Run an installation of the server side for each streamer device,install everything into a separate directory and give a differentport number to each installed server. This can be done giving eachserver an own service name. For the default installation, theservice is named "afbackup" and has port number 2988. Thus, entriesare provided in files in /etc:/etc/services:afbackup 2988/tcp/etc/inetd:afbackup stream tcp nowait ...For a second server, you may add appropriate lines, e.g.:/etc/services:afbackup2 2989/tcp/etc/inetd.conf:afbackup2 stream tcp nowait ...Note, that the paths to the configuration files later in the inetd.conf-lines must be adapted to each installation, respectively. To get theservices active, send a Hangup-Signal to the inetd.(ps ..., kill -HUP <PID>)It is important, that every server of several running on the samehost has it's own lock file. So e.g. configure lockfiles, thatare located in each server's var-directories. If they all shareone lockfile, several servers cannot run at the same time, whatis usually not, what you want.The relations between backup clients and streamer devices on theserver must be unique. Thus the /etc/services on the clients mustcontain the appropriate port number for the backup entry, e.g.:afbackup 2990/tcpNote, that on the clients the service name must always be "afbackup"and not "afbackup2" or whatever.As an alternative, you can supply the individual port number inthe clientside configuration. If you do so, no changes must bemade in any clientside system file, here /etc/services.Do not use NIS (YP) for maintaining the afbackup-services-entry, i.e.do not add the entry with "afbackup" above to your NIS-master-services-file.It is anyway better not to use the files /etc/passwd ... as sourcesfor your NIS-master-server, but to use a copy of them in a separatedirectory (as usually configured on Solaris and other Unixes).--------------------------------------------------------------------------5. How to recover from a server crash during backup ?With some devices there will be the problem, that the end-of-tape markis not written on power-down during writing to the tape. Even worse,when power is up again, the position, where the head is currently placed,gets corrupt, even if no write access has been applied at power-down.Some streamers are furthermore unable to start to write at a tapeposition, where still records follow, e.g. if there are 5 files on tape,it is e.g. impossible to go to file 2 and start to write there. AnI/O-error will be reported.The only way to solve this is to tell the backup system to start towrite at the beginning of the next cartridge. If the next cartridgehas e.g. the label-number 5, log on to the backup server, become rootand type: /your/path/to/server/bin/cartis -i 5 1--------------------------------------------------------------------------6. How to port to other operating systems ?* Unix-like systems *This is not that difficult. The GNU-make is mandatory, but this isusually no problem. A good way to start is to grep for AIX or sunover all .c- and .h-files, edit them as needed and run the make.You might want to run the prosname.sh to find out a specifier foryour operating system. This specifier will be defined as a macroduring compilation (exactly: prepocessing).An important point is the x_types.h-file. Here the types should beadapted as described in the comments in this file, lines 28-43.Insert ifdef-s as needed like for the OSF 1 operating system on alpha(macros __osf__ and __alpha). Note, that depending on the macroUSE_DEFINE_FOR_X_TYPES the types will be #define-d instead oftypedef-d. This gives you more flexibility, if one of thosepossibilities is making problems.The next point is the behaviour of the C-library concerning theerrno-variable in case the tape comes to it's physical end. In mostcases errno is set to ENOSPC, but not always (e.g. AIX is special).This can be adapted modifying the definition of the macroEND_OF_TAPE (in budefs.h). This macro is only used in if-s as shown: if(END_OF_TAPE) ...Consult your man-pages for the behaviour of the system calls onyour machine. It might be found under rmt, write or ioctl.The next is the default name of the tape device. Define the macroDEFAULT_TAPE_DEVICE (in budefs.h) appropriately for your OS.A little pathological is the statfs(2) system call. It has a differentnumber of arguments depending on the system. Consult your man-pages,how it should be used. statfs is only used in write.cThere may be further patches to be done, but if your system is closeto POSIX this should be easy. The output of the compiler and/or thelinker should give the necessary hints.Please report porting successes to af@muc.de. Thanks.Good luck !* Win-whatever *This is my point of view:Porting to Microsoft's Features-and-bugs-accumulations is systematicallymade complicated by the Gates-Mafia. They spend a lot of time on takingcare, that it is as difficult as possible to port to/from Win-whatever.This is one of their monopolization strategies. Developers starting towrite programs shall have to make the basic decision: "Am i gonna hackfor Micro$oft's "operating systems", or for the others ?" Watching theso-called market this decision is quite easy: Of course they will programfor the "market leader". And as few as possible of what they produceshould be usable on other ("dated") platforms. Companies like Cygnusare providing cool tools (e. g. a port of the GNU-compiler) to makethings easier but due to the fact, that M$ are not providing so manyinternals to the public, in my opinion porting is nonetheless anannoying job. Thank Bill Gates for his genious strategies.In short, at the moment i'm not gonna provide information how to portto Micro$oft-platforms. If somebody will do a port, i don't hinder himbut will not provide any support for it. As this software (like the moston Unix) heavily relies on POSIX-conformance and Mafia$oft has announced,that the "POSIX-subsystem for NT" will not be shipped anymore in the nearfuture (BTW they discourage to use it at all "cause of security problems"(Bullshit) - see the Microsoft web pages), the porting job will eithersubstitute all POSIX-calls by Win32-stuff (super-heavy efforts), or bringonly temporary fun (see above).--------------------------------------------------------------------------7. How to provide recovery from hard crashes (disk crash, ...) ?A key to this is the clientside StartupInfoProgram parameter. Thiscommand should read the standard input and write it to some placeoutside of the local machine - to be more precise - not to a diskundergoing backups or containing the clientside backup log files.The information written to the standard input of this program isthe minimum information required to restore everything after acomplete loss of the saved filesystems and the client side of thebackup system. Recovery can be achieved using the restore-utilitywith the -e flag (See: PROGRAMS) and supplying the minimum recoveryinformation to the standard input of restore. Several options exist:- Write this information to a mail-program (assumed the mail folders are outside of the filesystems undergoing backup) and sending this information to a backup-user. Later the mailfile can be piped into the restore-utility (mail-related protocol lines and other unneeded stuff will be ignored). For each machine, that is a backup client, an individual mail user should be configured, cause the minimum restore information does NOT contain the hostname (to be able to restore to a different machine, what might make perfect sense in some situations)- Write the information into a file (of course: always append), that resides on an NFS-mounted filesystem, eventually for security reasons exported especially to this machine only. To be even more secure, the exported directory might be owned by a non-root-user, who is the only one, who may write to this directory. This way it can be avoided to export a directory with root-access. Then the StartupInfoProgram should be something like: su myuser -c "touch /path/to/mininfo; cat >> /path/to/mininfo" The mininfo-file should have a name, that allows to deduce the name of the backup-client, that wrote it. E.g. simply use the hostname for this file.- Write the information to a file on floppy disk. Then the floppy disk must always be in the drive, whenever a backup runs. The floppy could be mounted using the amd automounter as explained in ftp://ftp.zn.ruhr-uni-bochum.de/pub/linux/README.amd.floppy.cdrom or using the mtools usually installed for convenience. In the former case the command should contain a final sync. In the latter case the file must be first copied from floppy, then appended the information, finally copied back to floppy e.g. like this: mcopy -n a:mininfo /tmp/mininfo.$$; touch /tmp/mininfo.$$; \ cat >> /tmp/mininfo.$$; mcopy -o /tmp/mininfo.$$ a:mininfo; \ /bin/rm -f /tmp/mininfo.$$; exit 0 Note, that the whole command must be entered in one line using the (x)afclientconfig command. In the configuration file lineend escaping is allowed, but not recognized by (x)afclientconfig. An alternative is to put everything into one script, that is started as StartupInfoProgram (Don't forget to provide a good exit code on successful completion)My personal favourite is the second option, but individual preferencesor requirements might lead to different solutions. There are moreoptions here. If someone thinks, i have forgotten an important one,feel free to email me about it.It might be a good idea to compile afbackup linked statically withall required libraries (building afbackup e.g. using the commandmake EXTRA_LD_FLAGS=-static when using gcc), install it, run theconfiguration program(s), if not yet done, tar everything andput it to a floppy disk (if enough space is available).To recover from a heavy system crash perform the following steps:- Replace bad disk(s) as required- Boot from floppy or cdrom (the booted kernel must be network-able)- Add the backup server to /etc/hosts and the following line to /etc/services: afbackup 2988/tcp- Mount your new disk filesystem(s) e.g. in /tmp/a and in a way, that this directory reflects your original directory hierarchy below / (like usually most system setup tools do)- Untar your packed and statically linked afbackup-distribution, but NOT to the place, where it originally lived (e.g. /tmp/a/usr/backup), cause it will be overwritten, if you also saved the clientside afbackup-installation, what i strongly recommend.- Run the restore-command with -e providing the minimum restore information saved outside of the machine to stdin: /path/to/staticlinked/afrestore -C /tmp/a -e < /path/to/mininfo-fileBootsector stuff is NOT restored in this procedure. For Linuxyou will have to reinstall lilo, but this is usually no problem.--------------------------------------------------------------------------8. How to make differential backups ?A differential backup means for me: Save all filesystem entries modifiedsince the previous full backup, not only those modified since the lastincremental backup.This task can be accomplished using the -a option of the incr_backupcommand. It tells incr_backup to keep the timestamp. If -a is omittedone time, another differential backup is no longer possible since thetimestamp is modified without -a. So if differential backups are required,you have to do without incremental backups.--------------------------------------------------------------------------9. How to use several servers for one client ?Several storage units can be configured for one client. A storage unitis a combination of a hostname, a port number and a cartridge set number.Several servers can be configured on one machine, each operating an ownstreamer device or directory for storing the data.The storage units are configured by the first three parameters of theclient side. These are hostnames, port numbers and cartridge set numbers,respectively. Several entries can be made for each of these parameters.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -