View Issue Details

IDProjectCategoryView StatusLast Update
0001455bareos-coredirectorpublic2022-05-09 14:31
Reportermeilihao Assigned Tobruno-at-bareos  
PriorityimmediateSeveritymajorReproducibilitysometimes
Status closedResolutionno change required 
PlatformLinuxOSCentOSOS Version7
Product Version20.0.6 
Summary0001455: Restore job picks wrong storage
Description```bash
# bconsole
*list joblog jobid=10
 2022-04-29 11:19:56 bareos-dir JobId 10: Start Backup JobId 10, Job=jbackup_0a771ccca3094c5f997fcbb50d9af93c_o26GUop7.2022-04-29_11.19.54_53
 2022-04-29 11:19:56 bareos-dir JobId 10: Connected Storage daemon at 192.168.16.157:9103, encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
 2022-04-29 11:19:56 bareos-dir JobId 10: Using Device "pool_b25ac93101a749699b36399465bd5ee9" to write.
 2022-04-29 11:19:56 bareos-dir JobId 10: Probing client protocol... (result will be saved until config reload)
 2022-04-29 11:19:56 bareos-dir JobId 10: Connected Client: 0a771ccca3094c5f997fcbb50d9af93c at 192.168.16.37:9102, encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
 2022-04-29 11:19:56 bareos-dir JobId 10: Handshake: Immediate TLS 2022-04-29 11:19:56 bareos-dir JobId 10: Encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
 2022-04-29 11:19:18 KylinV10-xjh-37-fd JobId 10: Connected Storage daemon at 192.168.16.157:9103, encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
 2022-04-29 11:19:18 KylinV10-xjh-37-fd JobId 10: Extended attribute support is enabled
 2022-04-29 11:19:18 KylinV10-xjh-37-fd JobId 10: ACL support is enabled
 2022-04-29 11:19:56 bareos-sd JobId 10: Warning: Volume "Full-0004" not on device "pool_b25ac93101a749699b36399465bd5ee9" (/b25ac93101a749699b36399465bd5ee9/.rdbackup).
 2022-04-29 11:19:56 bareos-sd JobId 10: Marking Volume "Full-0004" in Error in Catalog.
 2022-04-29 11:19:56 bareos-sd JobId 10: Warning: Volume "Full-0004" not on device "pool_b25ac93101a749699b36399465bd5ee9" (/b25ac93101a749699b36399465bd5ee9/.rdbackup).
 2022-04-29 11:19:56 bareos-sd JobId 10: Marking Volume "Full-0004" in Error in Catalog.
 2022-04-29 11:19:56 bareos-sd JobId 10: Warning: stored/mount.cc:258 Open device "pool_b25ac93101a749699b36399465bd5ee9" (/b25ac93101a749699b36399465bd5ee9/.rdbackup) Volume "Full-0004" failed: ERR=stored/dev.cc:716 Could not open: /b25ac93101a749699b36399465bd5ee9/.rdbackup/Full-0004, ERR=No such file or directory

 2022-04-29 11:19:57 bareos-dir JobId 10: Created new Volume "Full-0005" in catalog.
 2022-04-29 11:19:57 bareos-sd JobId 10: Labeled new Volume "Full-0005" on device "pool_b25ac93101a749699b36399465bd5ee9" (/b25ac93101a749699b36399465bd5ee9/.rdbackup).
 2022-04-29 11:19:57 bareos-sd JobId 10: Wrote label to prelabeled Volume "Full-0005" on device "pool_b25ac93101a749699b36399465bd5ee9" (/b25ac93101a749699b36399465bd5ee9/.rdbackup)
 2022-04-29 11:20:08 bareos-sd JobId 10: Releasing device "pool_b25ac93101a749699b36399465bd5ee9" (/b25ac93101a749699b36399465bd5ee9/.rdbackup).
 2022-04-29 11:20:08 bareos-sd JobId 10: Elapsed time=00:00:11, Transfer rate=57.86 M Bytes/second
 2022-04-29 11:20:08 bareos-dir JobId 10: Insert of attributes batch table with 2 entries start
 2022-04-29 11:20:08 bareos-dir JobId 10: Insert of attributes batch table done
 2022-04-29 11:20:08 bareos-dir JobId 10: Bareos bareos-dir 21.1.2 (17Mar22):
  Build OS: Kylin Linux Advanced Server release V10 (Tercel)
  JobId: 10
  Job: jbackup_0a771ccca3094c5f997fcbb50d9af93c_o26GUop7.2022-04-29_11.19.54_53
  Backup Level: Full
  Client: "0a771ccca3094c5f997fcbb50d9af93c" 20.0.4 (22Nov21) Kylin Linux Advanced Server release V10 (Tercel),redhat
  FileSet: "fileset_0a771ccca3094c5f997fcbb50d9af93c_o26GUop7" 2022-04-29 11:19:54
  Pool: "Full" (From Job FullPool override)
  Catalog: "MyCatalog" (From Client resource)
  Storage: "pool_b25ac93101a749699b36399465bd5ee9" (From Job resource)
  Scheduled time: 29-Apr-2022 11:19:54
  Start time: 29-Apr-2022 11:19:56
  End time: 29-Apr-2022 11:20:08
  Elapsed time: 12 secs
  Priority: 10
  FD Files Written: 2
  SD Files Written: 2
  FD Bytes Written: 636,502,016 (636.5 MB)
  SD Bytes Written: 636,502,212 (636.5 MB)
  Rate: 53041.8 KB/s
  Software Compression: None
  VSS: no
  Encryption: no
  Accurate: no
  Volume name(s): Full-0005
  Volume Session Id: 1
  Volume Session Time: 1651202382
  Last Volume Bytes: 636,975,083 (636.9 MB)
  Non-fatal FD errors: 0
  SD Errors: 0
  FD termination status: OK
  SD termination status: OK
  Bareos binary info: self-compiled: Get official binaries and vendor support on bareos.com
  Job triggered by: User
  Termination: Backup OK
*restore
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"

First you select one or more JobIds that contain files
to be restored. You will be presented several methods
of specifying the JobIds. Then you will be allowed to
select which files from those JobIds are to be restored.

To select the JobIds, you have the following choices:
 1: List last 20 Jobs run
 2: List Jobs where a given File is saved
 3: Enter list of comma separated JobIds to select
 4: Enter SQL list command
 5: Select the most recent backup for a client
 6: Select backup for a client before a specified time
 7: Enter a list of files to restore
 8: Enter a list of files to restore before a specified time
 9: Find the JobIds of the most recent backup for a client
10: Find the JobIds for a backup for a client before a specified time
11: Enter a list of directories to restore for found JobIds
12: Select full restore to a specified Job date
13: Cancel
Select item: (1-13): 1
+-------+----------------------------------+---------------------+----------+----------+---------------+
| jobid | client | starttime | joblevel | jobfiles | jobbytes |
+-------+----------------------------------+---------------------+----------+----------+---------------+
| 11 | 0a771ccca3094c5f997fcbb50d9af93c | 2022-04-29 11:20:37 | F | 2 | 636502016 |
| 10 | 0a771ccca3094c5f997fcbb50d9af93c | 2022-04-29 11:19:56 | F | 2 | 636502016 |
| 8 | 0a771ccca3094c5f997fcbb50d9af93c | 2022-04-29 11:03:18 | I | 0 | 0 |
| 7 | 0a771ccca3094c5f997fcbb50d9af93c | 2022-04-29 11:02:47 | F | 4 | 1598212096 |
| 5 | 0a771ccca3094c5f997fcbb50d9af93c | 2022-04-29 10:51:26 | F | 2 | 1598212096 |
| 4 | 0a771ccca3094c5f997fcbb50d9af93c | 2022-04-29 10:50:57 | F | 2 | 1598212096 |
| 3 | 0a771ccca3094c5f997fcbb50d9af93c | 2022-04-29 10:49:33 | F | 1 | 0 |
| 2 | 0a771ccca3094c5f997fcbb50d9af93c | 2022-04-29 10:48:08 | I | 0 | 0 |
| 1 | 0a771ccca3094c5f997fcbb50d9af93c | 2022-04-29 10:47:22 | F | 4 | 57873315 |
+-------+----------------------------------+---------------------+----------+----------+---------------+
To select the JobIds, you have the following choices:
 1: List last 20 Jobs run
 2: List Jobs where a given File is saved
 3: Enter list of comma separated JobIds to select
 4: Enter SQL list command
 5: Select the most recent backup for a client
 6: Select backup for a client before a specified time
 7: Enter a list of files to restore
 8: Enter a list of files to restore before a specified time
 9: Find the JobIds of the most recent backup for a client
10: Find the JobIds for a backup for a client before a specified time
11: Enter a list of directories to restore for found JobIds
12: Select full restore to a specified Job date
13: Cancel
Select item: (1-13): 3
Enter JobId(s), comma separated, to restore: 10
You have selected the following JobId: 10

Building directory tree for JobId(s) 10 ...
1 files inserted into the tree.

You are now entering file selection mode where you add (mark) and
remove (unmark) files to be restored. No files are initially added, unless
you used the "all" keyword on the command line.
Enter "done" to leave this mode.

cwd is: /
$ ls
XJH/
$ cd XJH/
cwd is: /XJH/
$ ls
ubuntu-16.04.1-server-arm64.iso
$ mark ubuntu-16.04.1-server-arm64.iso
1 file marked.
$ done
Storage "" not found, using Storage "pool_e9cf9ff22acc4d4a9114db333cc62ec8" from MediaType "File".
Bootstrap records written to /var/lib/bareos/bareos-dir.restore.3.bsr

The job will require the following
   Volume(s) Storage(s) SD Device(s)
===========================================================================
   
    Full-0005

Volumes marked with "*" are online.


1 file selected to be restored.

Defined Clients:
1: 0a771ccca3094c5f997fcbb50d9af93c
2: bareos-fd
Select the Client (1-2): 1
Using Catalog "MyCatalog"
Run Restore job
JobName: RestoreFiles
Bootstrap: /var/lib/bareos/bareos-dir.restore.3.bsr
Where: /tmp/bareos-restores
Replace: Always
FileSet: LinuxAll
Backup Client: 0a771ccca3094c5f997fcbb50d9af93c
Restore Client: 0a771ccca3094c5f997fcbb50d9af93c
Format: Native
Storage: pool_e9cf9ff22acc4d4a9114db333cc62ec8
When: 2022-05-05 14:21:38
Catalog: MyCatalog
Priority: 10
Plugin Options: *None*
OK to run? (yes/mod/no): yes
Job queued. JobId=16
*list joblog jobid=16
No results to list.
*list joblog jobid=16
 2022-05-05 14:22:25 bareos-dir JobId 16: Start Restore Job RestoreFiles.2022-05-05_14.21.59_07
 2022-05-05 14:22:25 bareos-dir JobId 16: Connected Storage daemon at 192.168.16.157:9103, encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
 2022-05-05 14:22:25 bareos-dir JobId 16: Using Device "pool_e9cf9ff22acc4d4a9114db333cc62ec8" to read.
 2022-05-05 14:22:25 bareos-dir JobId 16: Connected Client: 0a771ccca3094c5f997fcbb50d9af93c at 192.168.16.37:9102, encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
 2022-05-05 14:22:25 bareos-dir JobId 16: Handshake: Immediate TLS 2022-05-05 14:22:25 bareos-dir JobId 16: Encryption: TLS_CHACHA20_POLY1305_SHA256 TLSv1.3
 2022-05-05 14:22:27 bareos-sd JobId 16: Warning: stored/acquire.cc:286 Read open device "pool_e9cf9ff22acc4d4a9114db333cc62ec8" (/e9cf9ff22acc4d4a9114db333cc62ec8/.rdbackup) Volume "Full-0005" failed: ERR=stored/dev.cc:716 Could not open: /e9cf9ff22acc4d4a9114db333cc62ec8/.rdbackup/Full-0005, ERR=No such file or directory

 2022-05-05 14:22:27 bareos-sd JobId 16: Please mount read Volume "Full-0005" for:
    Job: RestoreFiles.2022-05-05_14.21.59_07
    Storage: "pool_e9cf9ff22acc4d4a9114db333cc62ec8" (/e9cf9ff22acc4d4a9114db333cc62ec8/.rdbackup)
    Pool: Incremental
    Media type: File
```
cat fileset_0a771ccca3094c5f997fcbb50d9af93c_o26GUop7.conf
FileSet {
  Name = "fileset_0a771ccca3094c5f997fcbb50d9af93c_o26GUop7"
  Description = "Backup the catalog dump and Bareos configuration files."
  Include {
    Options {
      Signature = MD5
      One FS = No
    }
    File = "/XJH/"
  }
  Exclude {
    File = "/dev"
    File = "/proc"
    File = "/sys"
    File = "/run"
    File = "/var/run"
    File = "/tmp"
    File = "/var/tmp"
    File = "/.fsck"
    File = "/.journal"
  }
}

bareos-dir:
```bash
# cat pool_b25ac93101a749699b36399465bd5ee9.conf
Storage {
  Name = "pool_b25ac93101a749699b36399465bd5ee9"
  Address = "192.168.16.157"
  Password = "ga6P2SWgsMTmZQXkN/U60rxXYhnAlei7o9Bh3Q2MgrD4"
  Device = pool_b25ac93101a749699b36399465bd5ee9
  MediaType = "File"
}

# cat pool_e9cf9ff22acc4d4a9114db333cc62ec8.conf
Storage {
  Name = "pool_e9cf9ff22acc4d4a9114db333cc62ec8"
  Address = "192.168.16.157"
  Password = "ga6P2SWgsMTmZQXkN/U60rxXYhnAlei7o9Bh3Q2MgrD4"
  Device = pool_e9cf9ff22acc4d4a9114db333cc62ec8
  MediaType = "File"
}
```

bareos-sd:
```
# cat pool_b25ac93101a749699b36399465bd5ee9.conf
Device {
  Name = pool_b25ac93101a749699b36399465bd5ee9
  Media Type = File
  Archive Device = /b25ac93101a749699b36399465bd5ee9/.rdbackup
  LabelMedia = yes; # lets Bareos label unlabeled media
  Random Access = yes;
  AutomaticMount = yes; # when device opened, read it
  RemovableMedia = no;
  AlwaysOpen = no;
# cat pool_e9cf9ff22acc4d4a9114db333cc62ec8.conf
Device {
  Name = pool_e9cf9ff22acc4d4a9114db333cc62ec8
  Media Type = File
  Archive Device = /e9cf9ff22acc4d4a9114db333cc62ec8/.rdbackup
  LabelMedia = yes; # lets Bareos label unlabeled media
  Random Access = yes;
  AutomaticMount = yes; # when device opened, read it
  RemovableMedia = no;
  AlwaysOpen = no;
}
```
Steps To ReproduceI don't know how to reproduce but can provide all needed logs and config.
Tagsdirector, storage

Activities

meilihao

meilihao

2022-05-05 08:40

reporter   ~0004591

I had this problem on both 20.0.0 and 21.0.0
bruno-at-bareos

bruno-at-bareos

2022-05-05 13:56

manager   ~0004595

You setup mediatype without understanding the implication it has
see documentation https://docs.bareos.org/bareos-21/Configuration/StorageDaemon.html#config-Sd_Device_MediaType

Media type names are arbitrary in that you set them to anything you want, but they must be known to the volume database to keep track of which storage daemons can read which volumes. In general, each different storage type should have a unique Media Type associated with it.
meilihao

meilihao

2022-05-06 04:43

reporter   ~0004599

Solved. I set unique mediatype for each storage device.
bruno-at-bareos

bruno-at-bareos

2022-05-09 14:31

manager   ~0004602

configuration issue

Issue History

Date Modified Username Field Change
2022-05-05 08:35 meilihao New Issue
2022-05-05 08:35 meilihao Tag Attached: storage
2022-05-05 08:37 meilihao Tag Attached: director
2022-05-05 08:40 meilihao Note Added: 0004591
2022-05-05 13:56 bruno-at-bareos Note Added: 0004595
2022-05-06 04:43 meilihao Note Added: 0004599
2022-05-09 14:31 bruno-at-bareos Assigned To => bruno-at-bareos
2022-05-09 14:31 bruno-at-bareos Status new => closed
2022-05-09 14:31 bruno-at-bareos Resolution open => no change required
2022-05-09 14:31 bruno-at-bareos Note Added: 0004602