############################################################ # In bareos-sd.conf I have: ############################################################ Device { Name = LTO-2 Media Type = LTO-2 Archive Device = /dev/nst0 AutomaticMount = yes; AlwaysOpen = yes; RemovableMedia = yes; RandomAccess = no; Maximum File Size = 100GB Maximum Network Buffer Size = 65536 } ############################################################ # And in bareos-dir.conf I have: ############################################################ Pool { Name = DailyPool Pool Type = Backup Recycle = yes AutoPrune = yes Volume Retention = 1 year Maximum Volume Bytes = 400G Maximum Volumes = 10 } ############################################################ # Running btape: ############################################################ # btape -c /etc/bareos/bareos-sd.conf LTO-2 Tape block granularity is 1024 bytes. btape: butil.c:274-0 Using device: "LTO-2" for writing. btape: btape.c:487-0 open device "LTO-2" (/dev/nst0): OK *test === Write, rewind, and re-read test === I'm going to write 10000 records and an EOF then write 10000 records and an EOF, then rewind, and re-read the data to verify that it is correct. This is an *essential* feature ... btape: btape.c:1172-0 Wrote 10000 blocks of 64412 bytes. btape: btape.c:619-0 Wrote 1 EOF to "LTO-2" (/dev/nst0) btape: btape.c:1188-0 Wrote 10000 blocks of 64412 bytes. btape: btape.c:619-0 Wrote 1 EOF to "LTO-2" (/dev/nst0) btape: btape.c:1230-0 Rewind OK. 10000 blocks re-read correctly. Got EOF on tape. 10000 blocks re-read correctly. === Test Succeeded. End Write, rewind, and re-read test === btape: btape.c:1299-0 Block position test btape: btape.c:1311-0 Rewind OK. Reposition to file:block 0:4 Block 5 re-read correctly. Reposition to file:block 0:200 Block 201 re-read correctly. Reposition to file:block 0:9999 Block 10000 re-read correctly. Reposition to file:block 1:0 Block 10001 re-read correctly. Reposition to file:block 1:600 Block 10601 re-read correctly. Reposition to file:block 1:9999 Block 20000 re-read correctly. === Test Succeeded. End Write, rewind, and re-read test === === Append files test === This test is essential to Bareos. I'm going to write one record in file 0, two records in file 1, and three records in file 2 btape: btape.c:589-0 Rewound "LTO-2" (/dev/nst0) btape: btape.c:1930-0 Wrote one record of 64412 bytes. btape: btape.c:1932-0 Wrote block to device. btape: btape.c:619-0 Wrote 1 EOF to "LTO-2" (/dev/nst0) btape: btape.c:1930-0 Wrote one record of 64412 bytes. btape: btape.c:1932-0 Wrote block to device. btape: btape.c:1930-0 Wrote one record of 64412 bytes. btape: btape.c:1932-0 Wrote block to device. btape: btape.c:619-0 Wrote 1 EOF to "LTO-2" (/dev/nst0) btape: btape.c:1930-0 Wrote one record of 64412 bytes. btape: btape.c:1932-0 Wrote block to device. btape: btape.c:1930-0 Wrote one record of 64412 bytes. btape: btape.c:1932-0 Wrote block to device. btape: btape.c:1930-0 Wrote one record of 64412 bytes. btape: btape.c:1932-0 Wrote block to device. btape: btape.c:619-0 Wrote 1 EOF to "LTO-2" (/dev/nst0) btape: btape.c:487-0 open device "LTO-2" (/dev/nst0): OK btape: btape.c:589-0 Rewound "LTO-2" (/dev/nst0) btape: btape.c:1443-0 Now moving to end of medium. btape: btape.c:640-0 Moved to end of medium. We should be in file 3. I am at file 3. This is correct! Now the important part, I am going to attempt to append to the tape. btape: btape.c:1930-0 Wrote one record of 64412 bytes. btape: btape.c:1932-0 Wrote block to device. btape: btape.c:619-0 Wrote 1 EOF to "LTO-2" (/dev/nst0) btape: btape.c:589-0 Rewound "LTO-2" (/dev/nst0) Done appending, there should be no I/O errors Doing Bareos scan of blocks: 1 block of 64448 bytes in file 1 End of File mark. 2 blocks of 64448 bytes in file 2 End of File mark. 3 blocks of 64448 bytes in file 3 End of File mark. 1 block of 64448 bytes in file 4 End of File mark. Total files=4, blocks=7, bytes = 451,136 End scanning the tape. We should be in file 4. I am at file 4. This is correct! The above Bareos scan should have output identical to what follows. Please double check it ... === Sample correct output === 1 block of 64448 bytes in file 1 End of File mark. 2 blocks of 64448 bytes in file 2 End of File mark. 3 blocks of 64448 bytes in file 3 End of File mark. 1 block of 64448 bytes in file 4 End of File mark. Total files=4, blocks=7, bytes = 451,136 === End sample correct output === If the above scan output is not identical to the sample output, you MUST correct the problem or Bareos will not be able to write multiple Jobs to the tape. === Write, backup, and re-read test === I'm going to write three records and an EOF then backup over the EOF and re-read the last record. Bareos does this after writing the last block on the tape to verify that the block was written correctly. This is not an *essential* feature ... btape: btape.c:589-0 Rewound "LTO-2" (/dev/nst0) btape: btape.c:825-0 Wrote first record of 64412 bytes. btape: btape.c:836-0 Wrote second record of 64412 bytes. btape: btape.c:847-0 Wrote third record of 64412 bytes. btape: btape.c:619-0 Wrote 1 EOF to "LTO-2" (/dev/nst0) btape: btape.c:863-0 Backspaced over EOF OK. btape: btape.c:868-0 Backspace record OK. btape: btape.c:886-0 Block re-read correct. Test succeeded! === End Write, backup, and re-read test === === Forward space files test === This test is essential to Bareos. I'm going to write five files then test forward spacing btape: btape.c:589-0 Rewound "LTO-2" (/dev/nst0) btape: btape.c:1930-0 Wrote one record of 64412 bytes. btape: btape.c:1932-0 Wrote block to device. btape: btape.c:619-0 Wrote 1 EOF to "LTO-2" (/dev/nst0) btape: btape.c:1930-0 Wrote one record of 64412 bytes. btape: btape.c:1932-0 Wrote block to device. btape: btape.c:1930-0 Wrote one record of 64412 bytes. btape: btape.c:1932-0 Wrote block to device. btape: btape.c:619-0 Wrote 1 EOF to "LTO-2" (/dev/nst0) btape: btape.c:1930-0 Wrote one record of 64412 bytes. btape: btape.c:1932-0 Wrote block to device. btape: btape.c:1930-0 Wrote one record of 64412 bytes. btape: btape.c:1932-0 Wrote block to device. btape: btape.c:1930-0 Wrote one record of 64412 bytes. btape: btape.c:1932-0 Wrote block to device. btape: btape.c:619-0 Wrote 1 EOF to "LTO-2" (/dev/nst0) btape: btape.c:1930-0 Wrote one record of 64412 bytes. btape: btape.c:1932-0 Wrote block to device. btape: btape.c:1930-0 Wrote one record of 64412 bytes. btape: btape.c:1932-0 Wrote block to device. btape: btape.c:619-0 Wrote 1 EOF to "LTO-2" (/dev/nst0) btape: btape.c:1930-0 Wrote one record of 64412 bytes. btape: btape.c:1932-0 Wrote block to device. btape: btape.c:619-0 Wrote 1 EOF to "LTO-2" (/dev/nst0) btape: btape.c:589-0 Rewound "LTO-2" (/dev/nst0) btape: btape.c:1657-0 Now forward spacing 1 file. We should be in file 1. I am at file 1. This is correct! btape: btape.c:1669-0 Now forward spacing 2 files. We should be in file 3. I am at file 3. This is correct! btape: btape.c:589-0 Rewound "LTO-2" (/dev/nst0) btape: btape.c:1682-0 Now forward spacing 4 files. We should be in file 4. I am at file 4. This is correct! btape: btape.c:1700-0 Now forward spacing 1 more file. We should be in file 5. I am at file 5. This is correct! === End Forward space files test === * ############################################################ # Truncate tape ############################################################ # mt -f /dev/nst0 rewind; mt -f /dev/nst0 weof; mt -f /dev/nst0 rewind ############################################################ # Run bareos-sd in debug mode ############################################################ # bareos-sd -f -d 200 bareos-sd (90): stored_conf.c:837-0 Inserting Director res: i7-mon bareos-sd (90): stored_conf.c:837-0 Inserting Device res: FileStorage i7-sd (100): jcr.c:141-0 read_last_jobs seek to 192 i7-sd (100): jcr.c:148-0 Read num_items=10 i7-sd (8): crypto_cache.c:55-0 Could not open crypto cache file. /var/lib/bareos/bareos-sd.9103.cryptoc ERR=No such file or directory i7-sd (10): socket_server.c:112-0 stored: listening on port 9103 i7-sd (100): bnet_server_tcp.c:166-0 Addresses host[ipv4;0.0.0.0;9103] i7-sd (90): stored.c:643-0 calling init_dev /dev/nst0 i7-sd (100): sd_backends.c:112-0 init_backend_dev: testing backend /usr/lib64/bareos/backends/libbareossd-tape.so i7-sd (100): dev.c:393-0 init_dev: tape=1 dev_name=/dev/nst0 i7-sd (100): dev.c:395-0 dev=/dev/nst0 dev_max_bs=0 max_bs=0 i7-sd (10): stored.c:645-0 SD init done /dev/nst0 i7-sd (100): block.c:127-0 created new block of blocksize 64512 (dev->device->label_block_size) as dev->max_block_size is zero i7-sd (20): stored.c:664-0 calling first_open_device "LTO-2" (/dev/nst0) i7-sd (120): device.c:266-0 start open_output_device() i7-sd (129): device.c:285-0 Opening device. i7-sd (100): dev.c:561-0 open dev: type=2 dev_name="LTO-2" (/dev/nst0) vol= mode=OPEN_READ_ONLY i7-sd (100): dev.c:572-0 call open_device mode=OPEN_READ_ONLY i7-sd (190): dev.c:1006-0 Enter mount i7-sd (100): generic_tape_device.c:49-0 Open dev: device is tape i7-sd (100): generic_tape_device.c:60-0 Try open "LTO-2" (/dev/nst0) mode=OPEN_READ_ONLY i7-sd (100): generic_tape_device.c:88-0 Rewind after open i7-sd (100): generic_tape_device.c:996-0 In set_os_device_parameters i7-sd (100): generic_tape_device.c:1002-0 Set block size to zero i7-sd (100): generic_tape_device.c:1018-0 MTSETDRVBUFFER i7-sd (100): generic_tape_device.c:144-0 open dev: tape 4 opened i7-sd (100): dev.c:580-0 preserve=0xb7ffedc0 fd=4 i7-sd (129): device.c:291-0 open dev "LTO-2" (/dev/nst0) OK i7-sd (100): dev.c:502-0 setting minblocksize to 64512, maxblocksize to label_block_size=64512, on device "LTO-2" (/dev/nst0) i7-sd (100): label.c:76-0 Enter read_volume_label res=0 device="LTO-2" (/dev/nst0) vol= dev_Vol=*NULL* max_blocksize=64512 i7-sd (130): label.c:140-0 Big if statement in read_volume_label i7-sd (130): label.c:145-0 Requested Volume "" on "LTO-2" (/dev/nst0) is not a Bareos labeled Volume, because: ERR=block.c:1021 Read zero bytes at 0:0 on device "LTO-2" (/dev/nst0). i7-sd (100): label.c:173-0 No volume label - bailing out i7-sd (150): label.c:287-0 return 3 i7-sd (90): stored.c:643-0 calling init_dev /storage/---backup i7-sd (100): dev.c:393-0 init_dev: tape=0 dev_name=/storage/---backup i7-sd (100): dev.c:395-0 dev=/storage/---backup dev_max_bs=0 max_bs=0 i7-sd (10): stored.c:645-0 SD init done /storage/---backup i7-sd (100): block.c:127-0 created new block of blocksize 64512 (dev->device->label_block_size) as dev->max_block_size is zero i7-sd (200): job.c:457-0 Start stored free_jcr i7-sd (200): job.c:584-0 End stored free_jcr ############################################################ # here I run bconsole # then 'label storage=LTO-2 volume=BackupTape1 pool=DailyPool' # (see bconsole output below) ############################################################ i7-sd (110): socket_server.c:79-0 Conn: Hello Director i7-dir calling i7-sd (110): socket_server.c:97-0 Got a DIR connection at 07-Jan-2016 11:33:50 i7-sd (50): cram-md5.c:68-0 send: auth cram-md5 <1448380438.1452159230@i7-sd> ssl=0 i7-sd (100): cram-md5.c:123-0 cram-get received: auth cram-md5 <788601626.1452159230@i7-dir> ssl=0 i7-sd (99): cram-md5.c:143-0 sending resp to challenge: 94AP+9BSP8+5268QVX/hmB i7-sd (90): dir_cmd.c:256-0 Message channel init completed. i7-sd (199): dir_cmd.c:267-0 device->label_block_size) as dev->max_block_size is zero i7-sd (100): dev.c:432-0 Device "LTO-2" (/dev/nst0) has dev->device->max_block_size of 0 and dev->max_block_size of 0, dcr->VolMaxBlocksize is 0 i7-sd (100): dev.c:474-0 set minblocksize to 0, maxblocksize to 0 on device "LTO-2" (/dev/nst0) i7-sd (100): dev.c:483-0 created new block of buf_len: 0 on device "LTO-2" (/dev/nst0) i7-sd (100): block.c:127-0 created new block of blocksize 64512 (dev->device->label_block_size) as dev->max_block_size is zero i7-sd (100): dev.c:487-0 created new block of buf_len: 64512 on device "LTO-2" (/dev/nst0), freeing block i7-sd (100): dir_cmd.c:666-0 Stole device "LTO-2" (/dev/nst0) lock, writing label. i7-sd (90): dir_cmd.c:668-0 try_autoload_device - looking for volume_info i7-sd (100): autochanger.c:99-0 Device "LTO-2" (/dev/nst0) is not an autochanger i7-sd (100): dev.c:544-0 Close fd for mode change. i7-sd (100): dev.c:561-0 open dev: type=2 dev_name="LTO-2" (/dev/nst0) vol=BackupTape1 mode=OPEN_READ_WRITE i7-sd (100): dev.c:572-0 call open_device mode=OPEN_READ_WRITE i7-sd (190): dev.c:1006-0 Enter mount i7-sd (100): generic_tape_device.c:49-0 Open dev: device is tape i7-sd (100): generic_tape_device.c:60-0 Try open "LTO-2" (/dev/nst0) mode=OPEN_READ_WRITE i7-sd (100): generic_tape_device.c:88-0 Rewind after open i7-sd (100): generic_tape_device.c:996-0 In set_os_device_parameters i7-sd (100): generic_tape_device.c:1002-0 Set block size to zero i7-sd (100): generic_tape_device.c:1018-0 MTSETDRVBUFFER i7-sd (100): generic_tape_device.c:144-0 open dev: tape 4 opened i7-sd (100): dev.c:580-0 preserve=0xb7ffeb10 fd=4 i7-sd (100): dev.c:502-0 setting minblocksize to 64512, maxblocksize to label_block_size=64512, on device "LTO-2" (/dev/nst0) i7-sd (100): label.c:76-0 Enter read_volume_label res=0 device="LTO-2" (/dev/nst0) vol=BackupTape1 dev_Vol=*NULL* max_blocksize=64512 i7-sd (130): label.c:140-0 Big if statement in read_volume_label i7-sd (130): label.c:145-0 Requested Volume "BackupTape1" on "LTO-2" (/dev/nst0) is not a Bareos labeled Volume, because: ERR=block.c:1021 Read zero bytes at 0:0 on device "LTO-2" (/dev/nst0). i7-sd (100): label.c:173-0 No volume label - bailing out i7-sd (150): label.c:287-0 return 3 i7-sd (100): dev.c:502-0 setting minblocksize to 64512, maxblocksize to label_block_size=64512, on device "LTO-2" (/dev/nst0) i7-sd (150): label.c:348-0 write_volume_label() i7-sd (150): label.c:367-0 New VolName=BackupTape1 i7-sd (150): label.c:378-0 Label type=0 i7-sd (130): label.c:689-0 Start create_volume_label() i7-sd (100): dev.c:921-0 Clear volhdr vol= Volume Label: Id : Bareos 2.0 immortal VerNo : 20 VolName : BackupTape1 PrevVolName : VolFile : 0 LabelType : PRE_LABEL LabelSize : 0 PoolName : DailyPool MediaType : LTO-2 PoolType : Backup HostName : i7 Date label written: 07-Jan-2016 11:33 i7-sd (150): label.c:679-0 Created Vol label rec: FI=PRE_LABEL len=158 i7-sd (130): label.c:426-0 Wrote label of 158 bytes to "LTO-2" (/dev/nst0) i7-sd (130): label.c:430-0 Call write_block_to_dev() i7-sd (100): block.c:659-0 === Write error. fd=4 size=194 rtn=-1 dev_blk=0 blk_blk=0 errno=22: ERR=Invalid argument i7-sd (129): generic_tape_device.c:368-0 === weof_dev="LTO-2" (/dev/nst0) i7-sd (50): block.c:839-0 dir_update_volume_info terminate writing -- OK i7-sd (50): block.c:867-0 *** Leave terminate_writing_volume -- OK i7-sd (100): generic_tape_device.c:608-0 bsf i7-sd (100): generic_tape_device.c:714-0 bsr_dev i7-sd (130): label.c:432-0 Bad Label write on "LTO-2" (/dev/nst0): ERR=generic_tape_device.c:726 ioctl MTBSR error on "LTO-2" (/dev/nst0). ERR=Input/output error. i7-sd (150): vol_mgr.c:705-0 vol_unused: no vol on "LTO-2" (/dev/nst0) i7-sd (100): dev.c:921-0 Clear volhdr vol=BackupTape1 i7-sd (150): vol_mgr.c:705-0 vol_unused: no vol on "LTO-2" (/dev/nst0) i7-sd (200): job.c:457-0 Start stored free_jcr i7-sd (200): job.c:584-0 End stored free_jcr ############################################################ # bconsole output ############################################################ # bconsole Connecting to Director i7:9101 1000 OK: i7-dir Version: 15.2.2 (16 November 2015) Enter a period to cancel a command. *label storage=LTO-2 volume=BackupTape1 pool=DailyPool Automatically selected Catalog: MyCatalog Using Catalog "MyCatalog" Connecting to Storage daemon LTO-2 at i7:9103 ... Sending label command for Volume "BackupTape1" Slot 0 ... block.c:630 Write error at 0:0 on device "LTO-2" (/dev/nst0). ERR=Invalid argument. block.c:644 Write error on fd=4 at file:blk 0:0 on device "LTO-2" (/dev/nst0). ERR=Invalid argument. Backspace record at EOT failed. ERR=Input/output error 3912 Failed to label Volume: ERR=generic_tape_device.c:726 ioctl MTBSR error on "LTO-2" (/dev/nst0). ERR=Input/output error. Label command failed for Volume BackupTape1. Do not forget to mount the drive!!! * ############################################################ # Hardware and system info ############################################################ # lspci | grep -i adaptec 04:04.0 SCSI storage controller: Adaptec ASC-29320ALP U320 (rev 10) # lsscsi | grep LTO [8:0:3:0] tape IBM HH LTO Gen 2 0468 /dev/st0 # uname -a Linux i7 4.1.13-5-default #1 SMP PREEMPT Thu Nov 26 16:35:17 UTC 2015 (49475c3) x86_64 x86_64 x86_64 GNU/Linux # groups bareos bareos : bareos disk tape # ls -alF /dev/nst0 crw-rw---- 1 root tape 9, 128 Jan 7 09:21 /dev/nst0