static int ignored_msgs = 0;
static uint64_t currentVolumeSize;
-static int64_t last_pct = -1;
+static int last_pct = -1;
static bool showProgress = false;
static int num_jobs = 0;
static int num_pools = 0;
" -p proceed inspite of I/O errors\n"
" -r list records\n"
" -s synchronize or store in database\n"
+" -S show scan progress periodically\n"
" -v verbose\n"
" -V <Volumes> specify Volume names (separated by |)\n"
" -w <dir> specify working directory (default from conf file)\n"
}
dev = bjcr->dcr->dev;
if (showProgress) {
+ char ed1[50];
struct stat sb;
fstat(dev->fd, &sb);
currentVolumeSize = sb.st_size;
- Pmsg1(000, _("Current Volume Size = %" llu "\n"), currentVolumeSize);
+ Pmsg1(000, _("First Volume Size = %sn"),
+ edit_uint64(currentVolumeSize, ed1));
}
if ((db=db_init_database(NULL, db_name, db_user, db_password,
bool stat = mount_next_read_volume(dcr);
if (showProgress) {
+ char ed1[50];
struct stat sb;
fstat(dev->fd, &sb);
currentVolumeSize = sb.st_size;
- Pmsg1(000, _("Current Volume Size = %" llu "\n"), currentVolumeSize);
+ Pmsg1(000, _("First Volume Size = %sn"),
+ edit_uint64(currentVolumeSize, ed1));
}
return stat;
}
if (rec->data_len > 0) {
mr.VolBytes += rec->data_len + WRITE_RECHDR_LENGTH; /* Accumulate Volume bytes */
if (showProgress) {
- int64_t pct = (mr.VolBytes * 100) / currentVolumeSize;
+ char ed1[50];
+ int pct = (mr.VolBytes * 100) / currentVolumeSize;
if (pct != last_pct) {
- fprintf(stdout, "done: %" lld "\n", pct);
+ fprintf(stdout, "done: %d%%\n", pct);
fflush(stdout);
last_pct = pct;
}
jobjcr->VolSessionId = rec->VolSessionId;
jobjcr->VolSessionTime = rec->VolSessionTime;
jobjcr->ClientId = jr->ClientId;
-// attach_jcr_to_device(dev, jobjcr);
new_dcr(jobjcr, dev);
return jobjcr;
}
Dmsg1(000, "Write ANSI label type=%d\n", label_type);
len = strlen(VolName);
if (len > 6) {
- len = 6; /* max len ANSI label */
+ Jmsg1(jcr, M_FATAL, 0, _("ANSI Volume label name \"%s\" longer than 6 chars.\n"),
+ VolName);
+ return false;
}
memset(label, ' ', sizeof(label));
ser_begin(label, sizeof(label));
/* Now construct HDR1 label */
ser_begin(label, sizeof(label));
ser_bytes("HDR1", 4);
- len = strlen(VolName);
- if (len > 17) {
- len = 17; /* Max filename len */
- }
- ser_bytes(VolName, len); /* stick Volume name in Filename field */
- if (len > 6) {
- len = 6;
- }
- ser_begin(&label[21], sizeof(label)-21);
+ ser_bytes("BACULA.DATA", 11); /* Filename field */
+ ser_begin(&label[21], sizeof(label)-21); /* fileset field */
ser_bytes(VolName, len); /* write Vol Ser No. */
ser_begin(&label[27], sizeof(label)-27);
ser_bytes("00010001000100", 14); /* File section, File seq no, Generation no */
Dmsg0(000, "No HDR1 label\n");
return VOL_NO_LABEL;
}
+ if (strncmp("BACULA.DATA", &label[4], 11) != 0) {
+ Dmsg0(000, "HD1 not Bacula label\n");
+ return VOL_NAME_ERROR;
+ }
break;
case 2:
if (stat != 80 || strncmp("HDR2", label, 4) != 0) {