Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workaround for EC2 mkfs volume label issue #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

workaround for EC2 mkfs volume label issue #44

wants to merge 1 commit into from

Conversation

westbywest
Copy link

mkfs fails formatting an EBS volume on an AWS instance running Ubuntu 12.04.4 LTS:

realm-cluster-node-2 Compiled Resource:
realm-cluster-node-2 ------------------
realm-cluster-node-2 # Declared in /var/chef/cache/cookbooks/volumes/recipes/format.rb:34:in `block in from_file'
realm-cluster-node-2 
realm-cluster-node-2 execute("/sbin/mkfs -t ext4  /dev/xvdb -L mnt") do
realm-cluster-node-2   action [:nothing]
realm-cluster-node-2   retries 0
realm-cluster-node-2   retry_delay 2
realm-cluster-node-2   guard_interpreter :default
realm-cluster-node-2   command "/sbin/mkfs -t ext4  /dev/xvdb -L mnt"
realm-cluster-node-2   backup 5
realm-cluster-node-2   returns 0
realm-cluster-node-2   cookbook_name "volumes"
realm-cluster-node-2   recipe_name "format"
realm-cluster-node-2   not_if "eval $(blkid -o export /dev/xvdb); test $TYPE = 'ext4'"
realm-cluster-node-2 end
realm-cluster-node-2 
realm-cluster-node-2 
realm-cluster-node-2 
realm-cluster-node-2 
realm-cluster-node-2 ================================================================================
realm-cluster-node-2 Recipe Compile Error in /var/chef/cache/cookbooks/volumes/recipes/format.rb
realm-cluster-node-2 ================================================================================
realm-cluster-node-2 
realm-cluster-node-2 
realm-cluster-node-2 Mixlib::ShellOut::ShellCommandFailed
realm-cluster-node-2 ------------------------------------
realm-cluster-node-2 execute[/sbin/mkfs -t ext4  /dev/xvdb -L mnt] (volumes::format line 34) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
realm-cluster-node-2 ---- Begin output of /sbin/mkfs -t ext4  /dev/xvdb -L mnt ----
realm-cluster-node-2 STDOUT: 
realm-cluster-node-2 STDERR: Usage: mkfs.ext4 [-c|-l filename] [-b block-size] [-C cluster-size]
realm-cluster-node-2    [-i bytes-per-inode] [-I inode-size] [-J journal-options]
realm-cluster-node-2    [-G meta group size] [-N number-of-inodes]
realm-cluster-node-2    [-m reserved-blocks-percentage] [-o creator-os]
realm-cluster-node-2    [-g blocks-per-group] [-L volume-label] [-M last-mounted-directory]
realm-cluster-node-2    [-O feature[,...]] [-r fs-revision] [-E extended-option[,...]]
realm-cluster-node-2    [-T fs-type] [-U UUID] [-jnqvFKSV] device [blocks-count]
realm-cluster-node-2 ---- End output of /sbin/mkfs -t ext4  /dev/xvdb -L mnt ----
realm-cluster-node-2 Ran /sbin/mkfs -t ext4  /dev/xvdb -L mnt returned 1

Volume definition which triggered this:

      volume(:mnt) do
        size              20
        keep              false
        create_at_launch  true
        device            '/dev/sdb' # Note: will appear as /dev/xvdb on modern ubuntus
        mount_point       '/mnt'
        mount_options     ['defaults', 'noatime']
        fstype            'ext4'
        attachable        :ebs
        formattable       true
        resizable         false
        tags( :persistent => true, :local => false, :bulk => false, :fallback => false )
      end

The sticking point seems to be using the -L parameter with mkfs. Running "sudo /sbin/mkfs -t ext4 /dev/xvdb" works as expected.

Leading from this thread on stack exchange, a work-around is to use e2label, i.e.

sudo /sbin/mkfs -t ext4  /dev/xvdb ; sudo e2label /dev/xvdb mnt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant