You are not logged in.

#1 2014-12-22 03:36:09

nstgc
Member
Registered: 2014-03-17
Posts: 393

[Solved]Can't attach bcache caching device; permission denied

I'm trying to set up a cached block device with bcache. I first was using the information in the Arch Wiki. I've created the backing device as well as the caching device, however when I go to attach the cache to the backing I'm given that I don't have permission, as root, to do so. I've checked the perisions with "ls -l" and root has full permissions "lrwxrwxrwx 1 root root 0 Dec 21 22:19 bcache0 -> ../devices/virtual/block/bcache0".

$ sudo echo "f17a3ee8-2408-48df-9485-36f934176f6d" > /sys/block/bcache0/bcache/attach
bash: /sys/block/bcache0/bcache/attach: Permission denied

At this point I looked elsewhere. I first tried to Google the issue, but that wasn't fruitful. I then went to the documentation over at the Evil Pie Pirate's place, and saw that it suggests to register the devices first as seen in line 49-52 here. To this end I tried "sudo echo /dev/sdb1 > /sys/fs/bcache/register", but, again, am told that I can't do that.

I'm not sure what I should do.

[edit] Solution: use "su" instead of "sudo".

[edit2] Also, for those curious, whatever bug was going around with bcache and btrfs not playing together well seems to have been fixed. I've tried out a number of use cases this morning -- including scrubbing, balancing, degragging, and snapshots -- and so far I haven't gotten any errors. All tests are being conducted on a partition that is being used solely for this test, and is not in normal use, and I haven't tried with a RAID of any sort yet.

Last edited by nstgc (2014-12-22 17:21:18)

Offline

#2 2014-12-22 06:02:29

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved]Can't attach bcache caching device; permission denied

Have you tried to run this as root, not with sudo?

Offline

#3 2014-12-22 14:11:35

nstgc
Member
Registered: 2014-03-17
Posts: 393

Re: [Solved]Can't attach bcache caching device; permission denied

karol wrote:

Have you tried to run this as root, not with sudo?

This worked. Thank you. By, by the way, would it make a difference?

Offline

#4 2014-12-22 17:58:31

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,665

Re: [Solved]Can't attach bcache caching device; permission denied

nstgc wrote:
$ sudo echo "f17a3ee8-2408-48df-9485-36f934176f6d" > /sys/block/bcache0/bcache/attach
bash: /sys/block/bcache0/bcache/attach: Permission denied

That command ran echo as root, then, as your normal user, tried to write to /sys/.../attach.  You can't do that smile

You could have said
sudo bash -c 'echo "f17a3ee8-2408-48df-9485-36f934176f6d" > /sys/block/bcache0/bcache/attach'


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#5 2014-12-22 20:32:02

nstgc
Member
Registered: 2014-03-17
Posts: 393

Re: [Solved]Can't attach bcache caching device; permission denied

ewaller wrote:
nstgc wrote:
$ sudo echo "f17a3ee8-2408-48df-9485-36f934176f6d" > /sys/block/bcache0/bcache/attach
bash: /sys/block/bcache0/bcache/attach: Permission denied

That command ran echo as root, then, as your normal user, tried to write to /sys/.../attach.  You can't do that smile

You could have said
sudo bash -c 'echo "f17a3ee8-2408-48df-9485-36f934176f6d" > /sys/block/bcache0/bcache/attach'

Ah, thank you.

Offline

Board footer

Powered by FluxBB