Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've set up a udev rule to attach a particular EBS volume as owned by a user, and this works. Here are the permissions on the device node after the volume has been attached:

brw-rw---- 1 myuser myuser 202, 240 Feb  4 20:21 /dev/xvdp

But when I try to run mkfs -t xfs /dev/xvdp I get the error:

mkfs.xfs: error - cannot set blocksize 512 on block device /dev/xvdp: Permission denied

If I run the command as root it succeeds OK, and if I change the filesystem type to ext4 the operation also succeeds.

What extra permission to I need to give the device so my user can format it without sudoing? Or is this likely a Xen or xfs bug?

I'm running amazon linux:
Linux version 3.2.36-1.46.amzn1.x86_64 (mockbuild@gobi-build-31003) (gcc version 4.6.2 20111027 (Red Hat 4.6.2-2) (GCC) ) #1 SMP Mon Jan 14 04:42:23 UTC 2013

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted
ioctl(... ,BLKBSZSET, ...)

requires root permissions.

You might try

mkfs -t xfs -s size=`blockdev --getbsz /dev/xvdp` /dev/xvdp

and see if not requiring a different blocksize will bypass the operation.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.