在 Fedora 23 中,我的/
分区格式为Btrfs
:
/dev/nvme0n1p4 / btrfs rw,seclabel,relatime,ssd,space_cache,subvolid=257,subvol=/root 0 0
完整输出:
$ sudo cat /proc/mounts
sysfs /sys sysfs rw,seclabel,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
devtmpfs /dev devtmpfs rw,seclabel,nosuid,size=16402952k,nr_inodes=4100738,mode=755 0 0
securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev/shm tmpfs rw,seclabel,nosuid,nodev 0 0
devpts /dev/pts devpts rw,seclabel,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,seclabel,nosuid,nodev,mode=755 0 0
tmpfs /sys/fs/cgroup tmpfs ro,seclabel,nosuid,nodev,noexec,mode=755 0 0
cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd 0 0
pstore /sys/fs/pstore pstore rw,seclabel,nosuid,nodev,noexec,relatime 0 0
efivarfs /sys/firmware/efi/efivars efivarfs rw,nosuid,nodev,noexec,relatime 0 0
cgroup /sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0
cgroup /sys/fs/cgroup/net_cls,net_prio cgroup rw,nosuid,nodev,noexec,relatime,net_cls,net_prio 0 0
cgroup /sys/fs/cgroup/hugetlb cgroup rw,nosuid,nodev,noexec,relatime,hugetlb 0 0
cgroup /sys/fs/cgroup/pids cgroup rw,nosuid,nodev,noexec,relatime,pids 0 0
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0
cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
configfs /sys/kernel/config configfs rw,relatime 0 0
/dev/nvme0n1p4 / btrfs rw,seclabel,relatime,ssd,space_cache,subvolid=257,subvol=/root 0 0
selinuxfs /sys/fs/selinux selinuxfs rw,relatime 0 0
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=34,pgrp=1,timeout=0,minproto=5,maxproto=5,direct 0 0
hugetlbfs /dev/hugepages hugetlbfs rw,seclabel,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,seclabel,relatime 0 0
tmpfs /tmp tmpfs rw,seclabel 0 0
mqueue /dev/mqueue mqueue rw,seclabel,relatime 0 0
nfsd /proc/fs/nfsd nfsd rw,relatime 0 0
/dev/sda1 /mnt/backup btrfs rw,seclabel,nosuid,nodev,relatime,ssd,space_cache,subvolid=5,subvol=/ 0 0
/dev/nvme0n1p2 /boot ext4 rw,seclabel,relatime,data=ordered 0 0
/dev/nvme0n1p4 /home btrfs rw,seclabel,relatime,ssd,space_cache,subvolid=258,subvol=/home 0 0
/dev/nvme0n1p1 /boot/efi vfat rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=winnt,errors=remount-ro 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0
tmpfs /run/user/42 tmpfs rw,seclabel,nosuid,nodev,relatime,size=3282696k,mode=700,uid=42,gid=42 0 0
tmpfs /run/user/1000 tmpfs rw,seclabel,nosuid,nodev,relatime,size=3282696k,mode=700,uid=1000,gid=1000 0 0
gvfsd-fuse /run/user/1000/gvfs fuse.gvfsd-fuse rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0
fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
我已经为以下内容创建了 Btrfs 配置/
:
$ sudo cat /etc/snapper/configs/root
[sudo] password for behrangsa:
# subvolume to snapshot
SUBVOLUME="/"
# filesystem type
FSTYPE="btrfs"
# users and groups allowed to work with config
ALLOW_USERS=""
ALLOW_GROUPS=""
# sync users and groups from ALLOW_USERS and ALLOW_GROUPS to .snapshots
# directory
SYNC_ACL="no"
# start comparing pre- and post-snapshot in background after creating
# post-snapshot
BACKGROUND_COMPARISON="yes"
# run daily number cleanup
NUMBER_CLEANUP="yes"
# limit for number cleanup
NUMBER_MIN_AGE="1800"
NUMBER_LIMIT="50"
NUMBER_LIMIT_IMPORTANT="10"
# create hourly snapshots
TIMELINE_CREATE="yes"
# cleanup hourly snapshots after some time
TIMELINE_CLEANUP="yes"
# limits for timeline cleanup
TIMELINE_MIN_AGE="1800"
TIMELINE_LIMIT_HOURLY="10"
TIMELINE_LIMIT_DAILY="10"
TIMELINE_LIMIT_WEEKLY="0"
TIMELINE_LIMIT_MONTHLY="10"
TIMELINE_LIMIT_YEARLY="10"
# cleanup empty pre-post-pairs
EMPTY_PRE_POST_CLEANUP="yes"
# limits for empty pre-post-pair cleanup
EMPTY_PRE_POST_MIN_AGE="1800"
IO Error
但是当我尝试创建一个简单的快照时,我得到了:
$ sudo snapper -v -c root create --description "pre-24"
IO Error.
在/var/log/snapper.log
我看到这些错误:
2016-06-24 00:20:56 ERR libsnapper(27862) FileUtils.cc(SDir):89 - open failed path://.snapshots/1 (No such file or directory)
2016-06-24 00:20:56 ERR libsnapper(27862) Snapshot.cc(nextNumber):392 - mkdir failed errno:13 (Permission denied)
不过我认为/.snapshots
拥有适当的权限:
$ ls -alh | grep snapshots
drwxr-xr-x. 1 root behrangsa 0 Jun 23 23:56 .snapshots
有什么想法可能导致此问题以及如何修复它并创建快照吗?
编辑:即使转换/.snapshots
为子卷后,我仍然得到IO Error
:
我将其转换为子卷,但我仍然得到IE Error
:
$ sudo btrfs subvolume list /
ID 257 gen 189002 top level 5 path root
ID 258 gen 189002 top level 5 path home
ID 516 gen 180550 top level 257 path var/lib/docker/btrfs/subvolumes/6de108471b3235a2a0d43289792ee8c0699f9538bf462406364f5d7d831111a6
ID 517 gen 180551 top level 257 path var/lib/docker/btrfs/subvolumes/6fd8e83c74afd25dc02862d1effd9a5a00fa26891e636d4e2b06fc3e104ea430-init
ID 518 gen 180552 top level 257 path var/lib/docker/btrfs/subvolumes/6fd8e83c74afd25dc02862d1effd9a5a00fa26891e636d4e2b06fc3e104ea430
ID 546 gen 180798 top level 257 path var/lib/docker/btrfs/subvolumes/31bdd669f045dbd3608211199575aa79eaa7c482f38b14829513e0637b29cb13
ID 547 gen 180799 top level 257 path var/lib/docker/btrfs/subvolumes/7122e49c0cc2638fc9a0c32deaf1631b25602a31a9c37e0e11497b99cdacf162
ID 548 gen 180800 top level 257 path var/lib/docker/btrfs/subvolumes/5a9cd4d33f3dc9032be3a851800a1ceb85398182d40de4c902b336cb1ae4f025
ID 549 gen 180801 top level 257 path var/lib/docker/btrfs/subvolumes/6c85c0e0e108cecc077fc69c93743bf9b3c43ebc24272d44bc30dedccdad1182
ID 550 gen 180802 top level 257 path var/lib/docker/btrfs/subvolumes/2f2866590451e437b1ed94aed9b18a14faf0191dc64bde078462c5f6bbdce395
ID 551 gen 180803 top level 257 path var/lib/docker/btrfs/subvolumes/53e56ab23cbbaa86ede63ae1e2573a9601e3ad65bb5072b28b29d9406697e61d
ID 552 gen 180804 top level 257 path var/lib/docker/btrfs/subvolumes/38e706084f7c2e8651f8fd422b84cf26b221035fc03d32fa624881712120d166
ID 553 gen 180805 top level 257 path var/lib/docker/btrfs/subvolumes/b29cbc5c0fb503627c2fef76738970fc12139216aeb553ba5802be3cac8c6fcc
ID 554 gen 180806 top level 257 path var/lib/docker/btrfs/subvolumes/12decf5df853e912b54465f91b31b544f33f06105996c57a3ef36779ef127513
ID 555 gen 180807 top level 257 path var/lib/docker/btrfs/subvolumes/466c038802ff0d51770280246ab0478208351e0dcc744446892e6f9a01421169
ID 556 gen 180808 top level 257 path var/lib/docker/btrfs/subvolumes/3995a62b383ed204fd47ea4c8519783f34e9840821b477c74afd3210fc10f7f5
ID 557 gen 180809 top level 257 path var/lib/docker/btrfs/subvolumes/d4e10096f7fb505ef5bd8c188e0cd6775229a2b26a0df9a4fbb03559c4596ab4
ID 558 gen 180810 top level 257 path var/lib/docker/btrfs/subvolumes/7fbf4f7d789727c13d546b1856f733b4c3b57da938db66ee70499ec5aff9bb63
ID 559 gen 180811 top level 257 path var/lib/docker/btrfs/subvolumes/b7dce5871ff302505de72e13c44f76b3ec89c6a856d7afabffb027aa25c6768a
ID 560 gen 180812 top level 257 path var/lib/docker/btrfs/subvolumes/9f17db87172b4c93963550d1f7633ef91f29a606d0344229aa6ae4a397c7146a
ID 561 gen 180813 top level 257 path var/lib/docker/btrfs/subvolumes/dc04ce95b58c52e145b8e800966ac5c28931078e020cc8f82f8eae4de3130654
ID 562 gen 180814 top level 257 path var/lib/docker/btrfs/subvolumes/2b0d518c3ecfc873b3e3c97b74721014382ad618e0294b22e2c13da49c70eeac
ID 563 gen 180815 top level 257 path var/lib/docker/btrfs/subvolumes/efba740afd7027e9c951f071423c0fe6d4fd6e69761f6a0c7ae69e9d7cf6f20e
ID 564 gen 181136 top level 257 path var/lib/docker/btrfs/subvolumes/f59e52d2ec4956b2515247e152ffe8aa09977acbdc0e4c5b792b1bb7b9be9af6
ID 570 gen 181137 top level 257 path var/lib/docker/btrfs/subvolumes/fda2a6dae9c73ca75f88d94f93193f0ad8b6e17f6035717275a1afdfd32ac2d6-init
ID 571 gen 186492 top level 257 path var/lib/docker/btrfs/subvolumes/fda2a6dae9c73ca75f88d94f93193f0ad8b6e17f6035717275a1afdfd32ac2d6
ID 583 gen 188997 top level 257 path .snapshots
$ ls -alh | grep snapshots
drwxr-xr-x. 1 root behrangsa 0 Jun 24 09:15 .snapshots
$ sudo snapper -v -c root create --description "pre-24"
IO Error.
$ sudo cat /var/log/snapper.log
2016-06-24 09:20:21 MIL libsnapper(25125) Snapshot.cc(read):223 - found 1 snapshots
2016-06-24 09:20:21 ERR libsnapper(25125) FileUtils.cc(SDir):89 - open failed path://.snapshots/1 (No such file or directory)
2016-06-24 09:20:21 ERR libsnapper(25125) Snapshot.cc(nextNumber):392 - mkdir failed errno:13 (Permission denied)
2016-06-24 09:20:51 MIL libsnapper(25125) Snapper.cc(~Snapper):114 - Snapper destructor
2016-06-24 09:21:21 MIL libsnapper(25125) snapperd.cc(main):282 - Exiting
答案1
自从 OP 提出这个问题以来已经好几年了,但今天我也偶然发现了这个问题......并且由于发生这种情况时我和他都在使用 Fedora,我相信这是由 SELinux 本身引起的(这并不奇怪。 ..:D)。
无论如何,如果其他人也偶然发现了这一点,请尝试以下操作:
sudo sestatus | grep -i "current"
如果您看到enforcing
,请尝试暂时禁用 SELinux:
sudo setenforce 0
并通过以下方式重试创建快照鲷鱼...;)
笔记:我打算向 SELinux 人员报告此事,看看是否可以稍微更新一下 snapper 的 SELinux 策略。