使用循环安装的用户创建的btrfs文件系统,并正确设置权限,用户可以自由创建btrfs子卷:
user@machine:~/btrfs/fs/snapshots$ /sbin/btrfs sub create newsubvol
Create subvolume './newsubvol'
但是,尝试删除新创建的子卷会导致错误:
user@machine:~/btrfs/fs/snapshots$ /sbin/btrfs sub del newsubvol
Delete subvolume '/home/user/btrfs/fs/snapshots/newsubvol'
ERROR: cannot delete '/home/user/btrfs/fs/snapshots/newsubvol'
root用户当然可以删除它:
root@machine:/home/user/btrfs/fs/snapshots# /sbin/btrfs sub del newsubvol
Delete subvolume '/home/user/btrfs/fs/snapshots/newsubvol'
创建和删除操作之间的行为差异似乎有些奇怪。谁能对此有所启发?
这是命令的确切顺序:
user@machine:~$ dd if=/dev/zero of=btrfs_disk bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 1.2345 s, 84.9 MB/s
user@machine:~$ mkdir mountpoint
user@machine:~$ /sbin/mkfs.btrfs btrfs_disk
WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using
SMALL VOLUME: forcing mixed metadata/data groups
Created a data/metadata chunk of size 8388608
fs created label (null) on btrfs_disk
nodesize 4096 leafsize 4096 sectorsize 4096 size 100.00MB
Btrfs Btrfs v0.19
user@machine:~$ sudo mount btrfs_disk mountpoint/
user@machine:~$ cd mountpoint/
user@machine:~/mountpoint$ /sbin/btrfs sub create test
Create subvolume './test'
user@machine:~/mountpoint$ /sbin/btrfs sub delete test
Delete subvolume '/home/user/mountpoint/test'
ERROR: cannot delete '/home/user/mountpoint/test' - Operation not permitted
这里是权限:
user@machine:~/mountpoint$ ls -la
total 4
drwxr-xr-x 1 user user 8 Set 4 09:30 .
drwx------ 1 user user 4486 Set 4 09:29 ..
drwx------ 1 user user 0 Set 4 09:38 test
和有关的行df -T
:
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/loop0 btrfs 102400 32 98284 1% /home/user/mountpoint
该发行版是Debian Wheezy的3.2.0-4-686-pae
内核v0.19
btrfs-tools。这种情况仍然出现在Ubuntu Saucy,3.11.0-4-generic
内核,v0.20-rc1
btrfs-tools上。
df -T
和btrfs version
?当我尝试相同的操作时,出现以下错误“错误:无法创建子卷-权限被拒绝”