Is it possible to backup files from a volume in a job from to another job?

Hello.
I have a job with ceph mounted volume and I need to backup files from the volume to external disk?
Is it possible to create a backup by running another periodic job? Maybe using an exec driver?
I don’t know how I can get access from one job to files in another job.

A Ceph RBD can be mapped by multiple clients, and same applied to Nomad.
With my understanding, you need to specify the access_mode to multi-node-single-writer when you register the Ceph volume

...
type = "csi"
plugin_id = "ceph-csi"
capability {
  access_mode     = "multi-node-single-writer"
  attachment_mode = "file-system"
}
...

Then a same volume can be mounted on two jobs, and you can transfer data between two jobs

I faced the same challenge to do DB backups, and used the rather new Nomad Actions to trigger the backups from a periodic job.

The periodic job is pretty simple:

job "nightly-backups" {
  datacenters = ["home"]
  type        = "batch"

  # runs nightly database backups for all the embedded databases
  # requires that the databases have a backup Action defined which can be called by Nomad

  periodic {
    crons            = ["0 3 * * * *"] # run every day at 3:00
    time_zone        = "Europe/Berlin"
    prohibit_overlap = true
  }

  group "nightly" {

    constraint {
      attribute = "${node.class}"
      value     = "compute"
    }

    task "backups" {
      driver = "exec"

      config {
        command = "/bin/sh"
        # command line arguments which call Nomad to execute the backup Action
        # add additional backup Actions as desired
        args    = ["-c", <<EOF
echo "backing up Unifi Network MongoDB"
nomad action -job=unifi-network -group=mongodb -task=mongodb backup-mongodb
echo "backing up Bookstack MariaDB"
nomad action -job=bookstack -group=bookstack -task=mariadb backup-mariadb
echo "finished running nightly backups"
EOF
        ]
      }

      # provide Nomad token with the necessary rights to execute the backup Actions
      template {
        destination = "secrets/variables.env"
        env             = true
        data            = <<EOH
{{- with nomadVar "nomad/jobs/nightly-backups" }}
NOMAD_TOKEN = "{{- .token }}"
TZ = "Europe/Berlin"
{{- end }}
EOH
      }

      resources {
        memory = 100
        cpu    = 100
      }
    }
  }
}

In the actual DB job, just add an Action to the DB task:

      # backs up the MongoDB database and removes all files in the backup folder which are older than 3 days
      action "backup-mongodb" {
        command = "/bin/sh"
        args    = ["-c", <<EOF
mongodump --gzip --archive=/storage/backup/backup.$(date +"%Y%m%d%H%M").gz
echo "cleaning up backup files older than 3 days ..."
find /storage/backup/* -mtime +3 -exec rm {} \;
EOF
        ]

The backup in this example goes to a folder which is mounted from my NAS, where in turn snapshots are taken and offsite-backup is done nightly.