Attempted moving git-data directory following documentation, error on reconfigure

I’m attempting to move the git-data repositories folder from its default location (/var/opt/gitlab/git-data) to an alternative location (/media/data/git-data).

I’ve followed the guide at
https://docs.gitlab.com/omnibus/settings/configuration.html#storing-git-data-in-an-alternative-directory

Setting the following in gitlab.rb
git_data_dirs({ "default" => { "path" => "/media/data/git-data" } })

However, when I attempt to run sudo gitlab-ctl upgrade I get an error on reconfigure.

Full output:

Checking PostgreSQL executables:Starting Chef Client, version 13.6.4
resolving cookbooks for run list: ["gitlab::config", "postgresql::bin"]
Synchronizing Cookbooks:
  - mattermost (0.1.0)
  - letsencrypt (0.1.0)
  - gitlab (0.0.1)
  - postgresql (0.1.0)
  - package (0.1.0)
  - nginx (0.1.0)
  - runit (0.14.2)
  - consul (0.0.0)
  - acme (3.1.0)
  - registry (0.1.0)
  - gitaly (0.1.0)
  - crond (0.1.0)
  - compat_resource (12.19.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 1 resources
Recipe: postgresql::bin
  * ruby_block[Link postgresql bin files to the correct version] action run (skipped due to only_if)

Running handlers:
Running handlers complete
Chef Client finished, 0/1 resources updated in 07 seconds
Checking PostgreSQL executables: OK
Shutting down all GitLab services except those needed for migrations
ok: down: alertmanager: 486s, normally up
ok: down: crond: 485s, normally up
ok: down: gitlab-monitor: 485s, normally up
ok: down: gitlab-workhorse: 484s, normally up
ok: down: logrotate: 484s, normally up
ok: down: nginx: 484s, normally up
ok: down: node-exporter: 484s, normally up
ok: down: postgres-exporter: 484s, normally up
ok: down: prometheus: 483s, normally up
ok: down: redis-exporter: 482s, normally up
ok: down: sidekiq: 482s, normally up
ok: down: unicorn: 482s, normally up
Ensuring the required services are running
ok: run: postgresql: (pid 149582) 382s
ok: run: redis: (pid 149584) 382s
ok: run: gitaly: (pid 149587) 382s
run: postgresql: (pid 149582) 382s; run: log: (pid 902) 4353339s
run: redis: (pid 149584) 382s; run: log: (pid 899) 4353339s
run: gitaly: (pid 149587) 382s; run: log: (pid 925) 4353339s
Reconfiguring GitLab to apply migrations
Starting Chef Client, version 13.6.4
resolving cookbooks for run list: ["gitlab"]
Synchronizing Cookbooks:
  - letsencrypt (0.1.0)
  - runit (0.14.2)
  - package (0.1.0)
  - gitlab (0.0.1)
  - postgresql (0.1.0)
  - registry (0.1.0)
  - mattermost (0.1.0)
  - crond (0.1.0)
  - nginx (0.1.0)
  - gitaly (0.1.0)
  - consul (0.0.0)
  - acme (3.1.0)
  - compat_resource (12.19.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Recipe: gitlab::default
  * directory[/etc/gitlab] action create (up to date)
  Converging 481 resources
  * directory[/etc/gitlab] action create (up to date)
  * directory[Create /var/opt/gitlab] action create (up to date)
  * directory[/opt/gitlab/embedded/etc] action create (up to date)
  * template[/opt/gitlab/embedded/etc/gitconfig] action create (up to date)
Recipe: gitlab::web-server
  * account[Webserver user and group] action create
    * group[Webserver user and group] action create (up to date)
    * linux_user[Webserver user and group] action create (up to date)
     (up to date)
Recipe: gitlab::users
  * directory[/var/opt/gitlab] action create (up to date)
  * account[GitLab user and group] action create
    * group[GitLab user and group] action create (up to date)
    * linux_user[GitLab user and group] action create (up to date)
     (up to date)
  * template[/var/opt/gitlab/.gitconfig] action create (up to date)
  * directory[/var/opt/gitlab/.bundle] action create (up to date)
Recipe: gitlab::gitlab-shell
  * storage_directory[/var/opt/gitlab/.ssh] action create
    * ruby_block[directory resource: /var/opt/gitlab/.ssh] action run (skipped due to not_if)
     (up to date)
  * directory[/var/log/gitlab/gitlab-shell/] action create (up to date)
  * directory[/var/opt/gitlab/gitlab-shell] action create (up to date)
  * templatesymlink[Create a config.yml and create a symlink to Rails root] action create
    * template[/var/opt/gitlab/gitlab-shell/config.yml] action create (up to date)
    * link[Link /opt/gitlab/embedded/service/gitlab-shell/config.yml to /var/opt/gitlab/gitlab-shell/config.yml] action create (up to date)
     (up to date)
  * link[/opt/gitlab/embedded/service/gitlab-shell/.gitlab_shell_secret] action create (up to date)
  * execute[/opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys check-permissions] action run
    - execute /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys check-permissions
  * bash[Set proper security context on ssh files for selinux] action run (skipped due to only_if)
Recipe: gitlab::gitlab-rails
  * storage_directory[/media/data/git-data] action create
    * ruby_block[directory resource: /media/data/git-data] action run
      
      ================================================================================
      Error executing action `run` on resource 'ruby_block[directory resource: /media/data/git-data]'
      ================================================================================
      
      Mixlib::ShellOut::ShellCommandFailed
      ------------------------------------
      Expected process to exit with [0], but received '1'
      ---- Begin output of stat --printf='%U' $(readlink -f /media/data/git-data) ----
      STDOUT: 
      STDERR: stat: missing operand
      Try 'stat --help' for more information.
      ---- End output of stat --printf='%U' $(readlink -f /media/data/git-data) ----
      Ran stat --printf='%U' $(readlink -f /media/data/git-data) returned 1
      
      Cookbook Trace:
      ---------------
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/storage_directory_helper.rb:35:in `run_command'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/storage_directory_helper.rb:67:in `get_owner'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/storage_directory_helper.rb:48:in `ensure_permissions_set'
      /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/resources/storage_directory.rb:39:in `block (3 levels) in class_from_file'
      
      Resource Declaration:
      ---------------------
      # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/resources/storage_directory.rb
      
       33:   ruby_block "directory resource: #{new_resource.path}" do
       34:     block do
       35:       # Ensure the directory exists
       36:       storage_helper.ensure_directory_exists(new_resource.path)
       37: 
       38:       # Ensure the permissions are set
       39:       storage_helper.ensure_permissions_set(new_resource.path)
       40: 
       41:       # Error out if we have not achieved the target permissions
       42:       storage_helper.validate!(new_resource.path)
       43:     end
       44:     not_if { storage_helper.validate(new_resource.path) }
       45:   end
       46: end
      
      Compiled Resource:
      ------------------
      # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/resources/storage_directory.rb:33:in `block in class_from_file'
      
      ruby_block("directory resource: /media/data/git-data") do
        action [:run]
        default_guard_interpreter :default
        block_name "directory resource: /media/data/git-data"
        declared_type :ruby_block
        cookbook_name "gitlab"
        block #<Proc:0x0000000004ef8e28@/opt/gitlab/embedded/cookbooks/cache/cookbooks/package/resources/storage_directory.rb:34>
        not_if { #code block }
      end
      
      System Info:
      ------------
      chef_version=13.6.4
      platform=ubuntu
      platform_version=16.04
      ruby=ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-linux]
      program_name=/opt/gitlab/embedded/bin/chef-client
      executable=/opt/gitlab/embedded/bin/chef-client
      
    
    ================================================================================
    Error executing action `create` on resource 'storage_directory[/media/data/git-data]'
    ================================================================================
    
    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    ruby_block[directory resource: /media/data/git-data] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/package/resources/storage_directory.rb line 33) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
    ---- Begin output of stat --printf='%U' $(readlink -f /media/data/git-data) ----
    STDOUT: 
    STDERR: stat: missing operand
    Try 'stat --help' for more information.
    ---- End output of stat --printf='%U' $(readlink -f /media/data/git-data) ----
    Ran stat --printf='%U' $(readlink -f /media/data/git-data) returned 1
    
    Cookbook Trace:
    ---------------
    /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/storage_directory_helper.rb:35:in `run_command'
    /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/storage_directory_helper.rb:67:in `get_owner'
    /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/libraries/storage_directory_helper.rb:48:in `ensure_permissions_set'
    /opt/gitlab/embedded/cookbooks/cache/cookbooks/package/resources/storage_directory.rb:39:in `block (3 levels) in class_from_file'
    
    Resource Declaration:
    ---------------------
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/gitlab-rails.rb
    
     44:   storage_directory git_data_directory['path'] do
     45:     owner gitlab_user
     46:     mode "0700"
     47:   end
     48: end
    
    Compiled Resource:
    ------------------
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/gitlab-rails.rb:44:in `block in from_file'
    
    storage_directory("/media/data/git-data") do
      action [:create]
      default_guard_interpreter :default
      declared_type :storage_directory
      cookbook_name "gitlab"
      recipe_name "gitlab-rails"
      owner "git"
      mode "0700"
      path "/media/data/git-data"
    end
    
    System Info:
    ------------
    chef_version=13.6.4
    platform=ubuntu
    platform_version=16.04
    ruby=ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-linux]
    program_name=/opt/gitlab/embedded/bin/chef-client
    executable=/opt/gitlab/embedded/bin/chef-client
    

Running handlers:
There was an error running gitlab-ctl reconfigure:

storage_directory[/media/data/git-data] (gitlab::gitlab-rails line 44) had an error: Mixlib::ShellOut::ShellCommandFailed: ruby_block[directory resource: /media/data/git-data] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/package/resources/storage_directory.rb line 33) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of stat --printf='%U' $(readlink -f /media/data/git-data) ----
STDOUT: 
STDERR: stat: missing operand
Try 'stat --help' for more information.
---- End output of stat --printf='%U' $(readlink -f /media/data/git-data) ----
Ran stat --printf='%U' $(readlink -f /media/data/git-data) returned 1

Running handlers complete
Chef Client failed. 1 resources updated in 10 seconds
Checking for an omnibus managed postgresql: OK
Checking for a newer version of PostgreSQL to install
No new version of PostgreSQL installed, nothing to upgrade to
Ensuring PostgreSQL is updated: OK
Restarting previously running GitLab services
ok: run: gitaly: (pid 149587) 396s
ok: run: postgresql: (pid 149582) 396s
ok: run: redis: (pid 149584) 396s

     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/
  

Upgrade complete! If your GitLab server is misbehaving try running
  sudo gitlab-ctl restart
before anything else.
If you need to roll back to the previous version you can use the database
backup made during the upgrade (scroll up for the filename).```