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

Fix mkfs.xfs cannot create volumes due to existing filesystems #62

Closed
wants to merge 1 commit into from
Closed

Conversation

wborn
Copy link

@wborn wborn commented Nov 27, 2018

Whenever we delete and recreate a Rancher (v1.6.21) container stack often LVM volumes cannot be recreated because mkfs.xfs refuses to overwrite existing filesystems and logs an error like the following:

Nov 21 16:35:55 atomic docker-lvm-plugin[3191]: Create: mkfs.xfs error: exit status 1 output mkfs.xfs: /dev/atomicos/mystack_mosquitto_cf159 appears to contain an existing filesystem (xfs_external_log).
                                                mkfs.xfs: Use the -f option to force overwrite.

See also this full logging.txt.

As a result the affected containers fail to start because their volumes cannot be recreated.

This PR modifies the docker-lvm-plugin by adding the -f option to mkfs.xfs command so this issue no longer occurs.

Do you think it is a good idea to force overwrite by default or should we make this configurable with a configuration option?

Additional environment details:

  • CentOS Linux 7.1810
  • docker-1.13.1-75.git8633870.el7.centos.x86_64
  • AMD64 architecture

@wborn wborn changed the title Fix mkfs.xfs cannnot create volumes due to existing filesystems Fix mkfs.xfs cannot create volumes due to existing filesystems Nov 27, 2018
Signed-off-by: Wouter Born <eclipse@maindrain.net>
@maartenl945
Copy link

maartenl945 commented Nov 28, 2018

Yes, I've noticed the same problem that volumes can sometimes not be created with the plugin if they've been created and deleted before. Apparently, the delete doesn't fully clean-up the volume on the file system.

@ashald
Copy link
Contributor

ashald commented Dec 5, 2018

We ran into the same issue but we're somehow concerned with just forcing mkfs to overwrite the FS.
It seems that the root cause of the issue is that lvcreate detects xfs signature at the beginning of the volume and asks for a confirmation to zero it (the default behavior). Because there is not stdin attached confirmation is not given and lvcreate just creates the volume without zeroing its beginning. This in turn leads to an error with mkfs. Adding -y to lvcreate forces a yes answer to zeriong question and makes sure that volume beginning will be properly cleared.

@wborn
Copy link
Author

wborn commented Dec 20, 2018

Thanks for merging the other fix @shishir-a412ed ! I'll close this PR now.

@wborn wborn closed this Dec 20, 2018
@wborn wborn deleted the mkfs.xfs-f branch December 20, 2018 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants