tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[PATCH] dump -U to specify dumpdates device
Hello
I have been running into situations where dump(8) could not figure the
device to use for updating /etc/dumpdates. It seems to be the case
when I give dump(8) a mount point associated with a NAME= label in /etc/fstab
It also obviously happens when we dump a filesystem subdirectory. Here
-u is forbidden because there cannot be an associated device, but we
could sill want to track backup status with a pseudoentry in /etc/dumpdates
I propose to add -U option to dump(8), which lets the administrator
specify the device name in /etc/dumpdates. Example usages:
dump -a0uf /dump/data.dump -D NAME=data /data/
dump -a0uf /dump/data-abc.dump -D data-abc /data/a* /data/b* /data/c*
Here is the patch. Opinions?
Index: dump.8
===================================================================
RCS file: /cvsroot/src/sbin/dump/dump.8,v
retrieving revision 1.69
diff -U4 -r1.69 dump.8
--- dump.8 15 Jul 2018 06:14:13 -0000 1.69
+++ dump.8 20 Mar 2019 08:09:00 -0000
@@ -50,8 +50,9 @@
.Op Fl l Ar timeout
.Op Fl r Ar cachesize
.Op Fl s Ar feet
.Op Fl T Ar date
+.Op Fl U Ar dumpdev
.Op Fl x Ar snap-backup
.Ar files-to-dump
.Nm
.Op Fl W Li \&| Fl w
@@ -298,12 +299,24 @@
The file
.Pa /etc/dumpdates
may be edited to change any of the fields,
if necessary.
-If a list of files or subdirectories is being dumped
+If the
+.Fl T
+option is used or if a list of files or subdirectories is being dumped
(as opposed to an entire file system), then
.Fl u
is ignored.
+.It Fl U Ar dumpdev
+Same as
+.Fl u
+but specifies the device in
+.Pa /etc/dumpdates
+as
+.Ar dumpdev .
+This option can be used with subdir dumps and with the
+.Fl T
+option.
.It Fl W
.Nm
tells the operator what file systems need to be dumped.
This information is gleaned from the files
--- dump.h 1 Mar 2019 16:42:11 -0000 1.56
+++ dump.h 20 Mar 2019 08:09:00 -0000
@@ -114,8 +114,9 @@
const char *temp; /* name of the file for doing rewrite of dumpdates */
char lastlevel; /* dump level of previous dump */
char level; /* dump level of this dump */
int uflag; /* update flag */
+const char *dumpdev; /* device name in dumpdates */
int eflag; /* eject flag */
int lflag; /* autoload flag */
int diskfd; /* disk file descriptor */
int tapefd; /* tape file descriptor */
--- itime.c 1 Mar 2019 16:42:11 -0000 1.21
+++ itime.c 20 Mar 2019 08:09:00 -0000
@@ -128,11 +128,11 @@
getdumptime(void)
{
struct dumpdates *ddp;
int i;
- char *fname;
+ const char *fname;
- fname = disk;
+ fname = dumpdev ? dumpdev : disk;
#ifdef FDEBUG
msg("Looking for name %s in dumpdates = %s for level = %c\n",
fname, dumpdates, level);
#endif
@@ -169,17 +169,17 @@
FILE *df;
struct dumpdates *dtwalk, *dtfound;
int i;
int fd;
- char *fname;
+ const char *fname;
- if(uflag == 0)
+ if(uflag == 0 && dumpdev == NULL)
return;
if ((df = fopen(dumpdates, "r+")) == NULL)
quite(errno, "cannot rewrite %s", dumpdates);
fd = fileno(df);
(void) flock(fd, LOCK_EX);
- fname = disk;
+ fname = dumpdev ? dumpdev : disk;
free((char *)ddatev);
ddatev = 0;
nddates = 0;
readdumptimes(df);
--- main.c 1 Mar 2019 16:42:11 -0000 1.74
+++ main.c 20 Mar 2019 08:09:00 -0000
@@ -132,9 +132,9 @@
usage();
obsolete(&argc, &argv);
while ((ch = getopt(argc, argv,
- "0123456789aB:b:cd:eFf:h:ik:l:L:nr:s:StT:uWwx:X")) != -1)
+ "0123456789aB:b:cd:eFf:h:ik:l:L:nr:s:StT:uU:Wwx:X")) != -1)
switch (ch) {
/* dump level */
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
@@ -244,8 +244,12 @@
case 'u': /* update /etc/dumpdates */
uflag = 1;
break;
+ case 'U': /* dump device in /etc/dumpdates */
+ dumpdev = optarg;
+ break;
+
case 'W': /* what to do */
case 'w':
lastdump(ch);
exit(X_FINOK); /* do nothing else */
--
Emmanuel Dreyfus
manu%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index