[Share Experiences] 【教程】使用btrfs+timeshift秒级自动快照备份(超简单版本) Resolved
Tofloor
poster avatar
neko
deepin
Ecological co-builder
2023-05-10 01:49
Author

先手动分区安装,分区结构如下:

挂载点 文件系统 大小
efi efi 300MB
/boot ext4 4096MB(也可以用默认大小)
swap swap 与内存大小一致,超过16G内存的可以不要
/ btrfs 剩下的全部

安装完成后进行如下操作:

#创建/@子卷(必须,timeshift需要)

sudo btrfs subvolume snapshot / /@

#创建@home子卷(必须,timeshift需要)
sudo btrfs subvolume create /@home

#复制/home数据到@home
sudo cp -a /home/* /@home

修改/etc/default/grub,在GRUB_CMDLINE_LINUX_DEFAULT这行追加rootflags=subvol=@参数

如下:

# Generated by deepin-installer
GRUB_BACKGROUND="/boot/grub/themes/deepin/background.jpg"
GRUB_CMDLINE_LINUX_DEFAULT="splash quiet rootflags=subvol=@"
GRUB_DEFAULT=0
GRUB_DISTRIBUTOR="`/usr/bin/lsb_release -d -s 2>/dev/null || echo Deepin 23`"
GRUB_THEME="/boot/grub/themes/deepin/theme.txt"
GRUB_TIMEOUT=1
GRUB_GFXMODE=1024x768
DEEPIN_GFXMODE_DETECT=1

执行 sudo update-grub更新grub引导

然后先重启1次会进入子卷的初始快照,重启后执行下面操作

!!!以下操作重启后进行!!!
!!!以下操作重启后进行!!!
!!!以下操作重启后进行!!!


修改/etc/fstab文件(此时处于@子卷)

直接原有的 / 上修改,删除subvolid=x字段,将原来的subvol=/改成/@

UUID=xxxx-xxxx-xxxx-xxxx / btrfs rw,relatime,ssd,space_cache,subvol=/@ 0 0

复制上一条进行修改,将/改成/home ,subvol=/@改成/@home(注意不能有subvolid=x字段)

UUID=xxxx-xxxx-xxxx-xxxx /home btrfs rw,relatime,ssd,space_cache,subvol=/@home 0 0

再把/boot挂载注释掉(隔离初始的boot分区,如果要升级内核就到 grub菜单 按e删除 rootflags=subvol=@进入原始环境安装新内核后
执行 cp -av /lib/modules/* /@/lib/modules,主要是为了防止不同快照之间安装和卸载内核操作导致找不到内核模块无法进入系统,如果出现这种情况需要复制当前原始环境/lib/modules里面的文件到/@/lib/modules即可)

如图:

image.png

最后再重启,安装timeshift就可以正常开启快照功能了


image.png

timeshift下载地址:https://github.com/teejee2008/timeshift/releases/download/v22.06.1/timeshift_22.06.1_amd64.deb


timeshift_24.01.1_amd64.zip

Reply Favorite View the author
All Replies
1 / 3
To page
jjcui8595
deepin
2023-05-10 02:33
#1

感谢分享

Reply View the author
阿尼樱奈奈
Moderator
2023-05-10 03:04
#2

like

Reply View the author
hanzn-zzx
deepin
2023-05-10 03:36
#3

like学习了

Reply View the author
落日
deepin
2023-05-10 04:00
#4

收藏了,可惜现在btrfs还有一些比不上ext4的地方,不然我肯定直接换了

Reply View the author
忘记、过去
deepin
2023-05-10 04:02
#5

哇,这个教程比大佬你之前在知乎发的更靠谱啊 joy

之前那个教程里说直接复制根目录文件到 /@ 底下的,怎么都复制不下去......居然还能直接建快照是没想到的 XD

Reply View the author
青稚
Moderator
2023-05-10 04:09
#6

不错,点赞了。

Reply View the author
璀璨星空
deepin
2023-05-10 04:11
#7

下次装系统试试like

Reply View the author
2023开始学习
deepin
2023-05-10 04:16
#8

现在deepin能直接安装在btrfs了吗?这个文章的前提好像就是系统安装在btrfs上,文章是只适配timeshift。文章应该是其他系统搬运的吧

Reply View the author
qq4945286
deepin
2023-05-10 04:18
#9

将原来的subvol=/ 改成 /@

这个没看懂,改成那里换成什么

Reply View the author
辉夜
deepin
2023-05-10 05:03
#10
qq4945286

将原来的subvol=/ 改成 /@

这个没看懂,改成那里换成什么

subvol=/

变成

subvol=/@

Reply View the author
neko
deepin
Ecological co-builder
2023-05-10 05:14
#11
忘记、过去

哇,这个教程比大佬你之前在知乎发的更靠谱啊 joy

之前那个教程里说直接复制根目录文件到 /@ 底下的,怎么都复制不下去......居然还能直接建快照是没想到的 XD

XD居然还有人记得那个

Reply View the author
neko
deepin
Ecological co-builder
2023-05-10 05:17
#12
2023开始学习

现在deepin能直接安装在btrfs了吗?这个文章的前提好像就是系统安装在btrfs上,文章是只适配timeshift。文章应该是其他系统搬运的吧

因为timeshift只支持/@ /@home布局。而deepin目前不能安装到子卷(直接在安装的时候创建@和@home)。

Reply View the author
neko
deepin
Ecological co-builder
2023-05-10 05:27
#13
qq4945286

将原来的subvol=/ 改成 /@

这个没看懂,改成那里换成什么

因为timeshift只支持/@ /@home布局快照,这里就是把原来的/挂载点改成/@

Reply View the author
海水
deepin
2023-05-10 05:30
#14

snapper,timeshift的替代品

timeshiift对快照的名字有要求,snapper则没有限制,配合btrfs assistent使用的话,能够实现比timeshift更灵活的快照管理。

Reply View the author
neko
deepin
Ecological co-builder
2023-05-10 05:36
#15
海水

snapper,timeshift的替代品

timeshiift对快照的名字有要求,snapper则没有限制,配合btrfs assistent使用的话,能够实现比timeshift更灵活的快照管理。

新玩具Get!

Reply View the author
海水
deepin
2023-05-10 05:42
#16

使用btrfs作为根分区的话,可以使用compress=XXX的挂载参数,压缩的目的不在于节约空间,而在于限制频繁的读写,从而提高读写性能

Reply View the author
neko
deepin
Ecological co-builder
2023-05-10 05:45
#17
海水

使用btrfs作为根分区的话,可以使用compress=XXX的挂载参数,压缩的目的不在于节约空间,而在于限制频繁的读写,从而提高读写性能

我电脑的奔腾cpu比较渣就没开XD

Reply View the author
蔡EEPIN
deepin
2023-05-10 07:12
#18

按照教程成功配置,感谢大佬~ 秒级快照真香😁

Reply View the author
Amz
deepin
2023-05-10 14:55
#19

支持,只是boot完全没必要搞成ext4

Reply View the author
Amz
deepin
2023-05-10 15:06
#20

这里帖一个我早期关于deepin跑在btrfs教程

https://bbs.deepin.org/zh/post/217231

Reply View the author
1 / 3
To page