Export translations
Jump to navigation
Jump to search
Settings
Group
32 bit chroot environment for Wine
32-bit Chroot
Applications/Editors
Btrfs
Emerge
Funtoo Linux First Steps
Funtoo Linux Kernels
Funtoo Linux Localization
Funtoo Profiles
Funtoo:Metro
Gentoo Linux
Gentoo Minimal Installation CD
GNOME First Steps
Install
Install/Bootloader
Install/Chroot
Install/Configuration Files
Install/Creating Filesystems
Install/Done
Install/Download and Extract Stage3
Install/Download LiveCD
Install/Download Portage Tree
Install/Finishing
Install/Get Acquainted
Install/GPT Partitioning
Install/Introducing Portage
Install/Introduction
Install/Kernel
Install/MBR Partitioning
Install/Mounting Filesystems
Install/Network
Install/Prepare Disk
Install/Profiles
Install/Setting the Date
InstallPrintable
LXD
Make.conf
MATE Desktop Environment
Package:Xfce4-meta
Support Matrix
Template:VMwareBlurb
Upgrade Instructions/1.2-release
Upgrade Instructions/1.3-release
Wolf Pack Philosophy
X Window System
ZFS
Language
aa - Afar
ab - Abkhazian
abs - Ambonese Malay
ace - Achinese
ady - Adyghe
ady-cyrl - Adyghe (Cyrillic script)
aeb - Tunisian Arabic
aeb-arab - Tunisian Arabic (Arabic script)
aeb-latn - Tunisian Arabic (Latin script)
af - Afrikaans
ak - Akan
aln - Gheg Albanian
alt - Southern Altai
am - Amharic
ami - Amis
an - Aragonese
ang - Old English
anp - Angika
ar - Arabic
arc - Aramaic
arn - Mapuche
arq - Algerian Arabic
ary - Moroccan Arabic
arz - Egyptian Arabic
as - Assamese
ase - American Sign Language
ast - Asturian
atj - Atikamekw
av - Avaric
avk - Kotava
awa - Awadhi
ay - Aymara
az - Azerbaijani
azb - South Azerbaijani
ba - Bashkir
ban - Balinese
ban-bali - ᬩᬲᬩᬮᬶ
bar - Bavarian
bbc - Batak Toba
bbc-latn - Batak Toba (Latin script)
bcc - Southern Balochi
bcl - Central Bikol
be - Belarusian
be-tarask - Belarusian (Taraškievica orthography)
bg - Bulgarian
bgn - Western Balochi
bh - Bhojpuri
bho - Bhojpuri
bi - Bislama
bjn - Banjar
bm - Bambara
bn - Bangla
bo - Tibetan
bpy - Bishnupriya
bqi - Bakhtiari
br - Breton
brh - Brahui
bs - Bosnian
btm - Batak Mandailing
bto - Iriga Bicolano
bug - Buginese
bxr - Russia Buriat
ca - Catalan
cbk-zam - Chavacano
cdo - Min Dong Chinese
ce - Chechen
ceb - Cebuano
ch - Chamorro
cho - Choctaw
chr - Cherokee
chy - Cheyenne
ckb - Central Kurdish
co - Corsican
cps - Capiznon
cr - Cree
crh - Crimean Tatar
crh-cyrl - Crimean Tatar (Cyrillic script)
crh-latn - Crimean Tatar (Latin script)
cs - Czech
csb - Kashubian
cu - Church Slavic
cv - Chuvash
cy - Welsh
da - Danish
de - German
de-at - Austrian German
de-ch - Swiss High German
de-formal - German (formal address)
din - Dinka
diq - Zazaki
dsb - Lower Sorbian
dtp - Central Dusun
dty - Doteli
dv - Divehi
dz - Dzongkha
ee - Ewe
egl - Emilian
el - Greek
eml - Emiliano-Romagnolo
en - English
en-ca - Canadian English
en-gb - British English
eo - Esperanto
es - Spanish
es-419 - Latin American Spanish
es-formal - Spanish (formal address)
et - Estonian
eu - Basque
ext - Extremaduran
fa - Persian
ff - Fulah
fi - Finnish
fit - Tornedalen Finnish
fj - Fijian
fo - Faroese
fr - French
frc - Cajun French
frp - Arpitan
frr - Northern Frisian
fur - Friulian
fy - Western Frisian
ga - Irish
gag - Gagauz
gan - Gan Chinese
gan-hans - Gan (Simplified)
gan-hant - Gan (Traditional)
gcr - Guianan Creole
gd - Scottish Gaelic
gl - Galician
glk - Gilaki
gn - Guarani
gom - Goan Konkani
gom-deva - Goan Konkani (Devanagari script)
gom-latn - Goan Konkani (Latin script)
gor - Gorontalo
got - Gothic
grc - Ancient Greek
gsw - Swiss German
gu - Gujarati
guc - Wayuu
gv - Manx
ha - Hausa
hak - Hakka Chinese
haw - Hawaiian
he - Hebrew
hi - Hindi
hif - Fiji Hindi
hif-latn - Fiji Hindi (Latin script)
hil - Hiligaynon
ho - Hiri Motu
hr - Croatian
hrx - Hunsrik
hsb - Upper Sorbian
ht - Haitian Creole
hu - Hungarian
hu-formal - Hungarian (formal address)
hy - Armenian
hyw - Western Armenian
hz - Herero
ia - Interlingua
id - Indonesian
ie - Interlingue
ig - Igbo
ii - Sichuan Yi
ik - Inupiaq
ike-cans - Eastern Canadian (Aboriginal syllabics)
ike-latn - Eastern Canadian (Latin script)
ilo - Iloko
inh - Ingush
io - Ido
is - Icelandic
it - Italian
iu - Inuktitut
ja - Japanese
jam - Jamaican Creole English
jbo - Lojban
jut - Jutish
jv - Javanese
ka - Georgian
kaa - Kara-Kalpak
kab - Kabyle
kbd - Kabardian
kbd-cyrl - Kabardian (Cyrillic script)
kbp - Kabiye
kcg - Tyap
kg - Kongo
khw - Khowar
ki - Kikuyu
kiu - Kirmanjki
kj - Kuanyama
kjp - Eastern Pwo
kk - Kazakh
kk-arab - Kazakh (Arabic script)
kk-cn - Kazakh (China)
kk-cyrl - Kazakh (Cyrillic script)
kk-kz - Kazakh (Kazakhstan)
kk-latn - Kazakh (Latin script)
kk-tr - Kazakh (Turkey)
kl - Kalaallisut
km - Khmer
kn - Kannada
ko - Korean
ko-kp - Korean (North Korea)
koi - Komi-Permyak
kr - Kanuri
krc - Karachay-Balkar
kri - Krio
krj - Kinaray-a
krl - Karelian
ks - Kashmiri
ks-arab - Kashmiri (Arabic script)
ks-deva - Kashmiri (Devanagari script)
ksh - Colognian
ku - Kurdish
ku-arab - Kurdish (Arabic script)
ku-latn - Kurdish (Latin script)
kum - Kumyk
kv - Komi
kw - Cornish
ky - Kyrgyz
la - Latin
lad - Ladino
lb - Luxembourgish
lbe - Lak
lez - Lezghian
lfn - Lingua Franca Nova
lg - Ganda
li - Limburgish
lij - Ligurian
liv - Livonian
lki - Laki
lld - Ladin
lmo - Lombard
ln - Lingala
lo - Lao
loz - Lozi
lrc - Northern Luri
lt - Lithuanian
ltg - Latgalian
lus - Mizo
luz - Southern Luri
lv - Latvian
lzh - Literary Chinese
lzz - Laz
mad - Madurese
mai - Maithili
map-bms - Basa Banyumasan
mdf - Moksha
mg - Malagasy
mh - Marshallese
mhr - Eastern Mari
mi - Maori
min - Minangkabau
mk - Macedonian
ml - Malayalam
mn - Mongolian
mni - Manipuri
mnw - Mon
mo - Moldovan
mr - Marathi
mrh - Mara
mrj - Western Mari
ms - Malay
mt - Maltese
mus - Muscogee
mwl - Mirandese
my - Burmese
myv - Erzya
mzn - Mazanderani
na - Nauru
nah - Nāhuatl
nan - Min Nan Chinese
nap - Neapolitan
nb - Norwegian Bokmål
nds - Low German
nds-nl - Low Saxon
ne - Nepali
new - Newari
ng - Ndonga
nia - Nias
niu - Niuean
nl - Dutch
nl-informal - Dutch (informal address)
nn - Norwegian Nynorsk
no - Norwegian
nov - Novial
nqo - N’Ko
nrm - Norman
nso - Northern Sotho
nv - Navajo
ny - Nyanja
nys - Nyungar
oc - Occitan
olo - Livvi-Karelian
om - Oromo
or - Odia
os - Ossetic
pa - Punjabi
pag - Pangasinan
pam - Pampanga
pap - Papiamento
pcd - Picard
pdc - Pennsylvania German
pdt - Plautdietsch
pfl - Palatine German
pi - Pali
pih - Norfuk / Pitkern
pl - Polish
pms - Piedmontese
pnb - Western Punjabi
pnt - Pontic
prg - Prussian
ps - Pashto
pt - Portuguese
pt-br - Brazilian Portuguese
qqq - Message documentation
qu - Quechua
qug - Chimborazo Highland Quichua
rgn - Romagnol
rif - Riffian
rm - Romansh
rmy - Vlax Romani
rn - Rundi
ro - Romanian
roa-tara - Tarantino
ru - Russian
rue - Rusyn
rup - Aromanian
ruq - Megleno-Romanian
ruq-cyrl - Megleno-Romanian (Cyrillic script)
ruq-latn - Megleno-Romanian (Latin script)
rw - Kinyarwanda
sa - Sanskrit
sah - Sakha
sat - Santali
sc - Sardinian
scn - Sicilian
sco - Scots
sd - Sindhi
sdc - Sassarese Sardinian
sdh - Southern Kurdish
se - Northern Sami
sei - Seri
ses - Koyraboro Senni
sg - Sango
sgs - Samogitian
sh - Serbo-Croatian
shi - Tachelhit
shi-latn - Tachelhit (Latin script)
shi-tfng - Tachelhit (Tifinagh script)
shn - Shan
shy - Shawiya
shy-latn - Shawiya (Latin script)
si - Sinhala
simple - Simple English
sk - Slovak
skr - Saraiki
skr-arab - Saraiki (Arabic script)
sl - Slovenian
sli - Lower Silesian
sm - Samoan
sma - Southern Sami
smn - Inari Sami
sn - Shona
so - Somali
sq - Albanian
sr - Serbian
sr-ec - Serbian (Cyrillic script)
sr-el - Serbian (Latin script)
srn - Sranan Tongo
ss - Swati
st - Southern Sotho
stq - Saterland Frisian
sty - Siberian Tatar
su - Sundanese
sv - Swedish
sw - Swahili
szl - Silesian
szy - Sakizaya
ta - Tamil
tay - Tayal
tcy - Tulu
te - Telugu
tet - Tetum
tg - Tajik
tg-cyrl - Tajik (Cyrillic script)
tg-latn - Tajik (Latin script)
th - Thai
ti - Tigrinya
tk - Turkmen
tl - Tagalog
tly - Talysh
tly-cyrl - толыши
tn - Tswana
to - Tongan
tpi - Tok Pisin
tr - Turkish
tru - Turoyo
trv - Taroko
ts - Tsonga
tt - Tatar
tt-cyrl - Tatar (Cyrillic script)
tt-latn - Tatar (Latin script)
tum - Tumbuka
tw - Twi
ty - Tahitian
tyv - Tuvinian
tzm - Central Atlas Tamazight
udm - Udmurt
ug - Uyghur
ug-arab - Uyghur (Arabic script)
ug-latn - Uyghur (Latin script)
uk - Ukrainian
ur - Urdu
uz - Uzbek
uz-cyrl - Uzbek (Cyrillic script)
uz-latn - Uzbek (Latin script)
ve - Venda
vec - Venetian
vep - Veps
vi - Vietnamese
vls - West Flemish
vmf - Main-Franconian
vo - Volapük
vot - Votic
vro - Võro
wa - Walloon
war - Waray
wo - Wolof
wuu - Wu Chinese
xal - Kalmyk
xh - Xhosa
xmf - Mingrelian
xsy - Saisiyat
yi - Yiddish
yo - Yoruba
yue - Cantonese
za - Zhuang
zea - Zeelandic
zgh - Standard Moroccan Tamazight
zh - Chinese
zh-cn - Chinese (China)
zh-hans - Simplified Chinese
zh-hant - Traditional Chinese
zh-hk - Chinese (Hong Kong)
zh-mo - Chinese (Macau)
zh-my - Chinese (Malaysia)
zh-sg - Chinese (Singapore)
zh-tw - Chinese (Taiwan)
zu - Zulu
Format
Export for off-line translation
Export in native format
Fetch
<div class="mw-translate-fuzzy"> <languages/> BTRFS 是一个基于写时复制 (COW) 原则的文件系统,最初是在 Oracle 公司设计的,用于 Linux。Btrfs 的开发始于 2007 年,自 2014 年 8 月起,该文件系统的磁盘格式被标记为稳定。 </div> <div class="mw-translate-fuzzy"> 2015 年,Btrfs 被采纳为 SUSE Linux Enterprise Server 12 的默认文件系统。在 RedHat 宣布停止支持 Btrfs 后,SUSE 于 2017 年重申了对 Btrfs 的承诺。 </div> Btrfs 旨在解决 Linux 文件系统中缺乏文件池、快照、校验和以及集成多设备跨度的问题。 <div class="mw-translate-fuzzy"> 设置和使用 BTRFS 非常简单。在这个简单的介绍中,我们将使用现有的 {{c|debian-sources}} 或 {{c|debian-sources-lts}} 内核在 Funtoo Linux 下设置 BTRFS,比如 Funtoo Linux 为你预置的内核,我们还将使用我们的 BTRFS 存储池来存储不属于 Funtoo Linux 安装本身的数据。Funtoo Linux 将从一个非 BTRFS 文件系统启动,作为初始化过程的一部分,将初始化我们的 BTRFS 存储,并将其挂载在我们选择的位置。 </div> == 安装 == <div class="mw-translate-fuzzy"> 安装 BTRFS 不需要任何额外的步骤,因为它是 Linux 内核的一部分(从 2.6.29 开始在主线 Linux 内核中)。让我们用 emerge 安装 BTRFS 用户空间工具 ({{c|btrfs-progs}})。 </div> <div class="mw-translate-fuzzy"> {{console|body= # ##i##emerge btrfs-progs }} </div> <div class="mw-translate-fuzzy"> BTRFS 现在可以使用了。 </div> <div class="mw-translate-fuzzy"> == BTRFS 概念 == </div> <div class="mw-translate-fuzzy"> BTRFS 可以用来管理它使用的物理磁盘,物理磁盘被添加到 BTRFS 卷中。然后,BTRFS 可以从卷中创建子卷,子卷上可以存储文件。 </div> <div class="mw-translate-fuzzy"> 与传统的 Linux 文件系统不同,BTRFS 文件系统将从底层卷按需分配存储空间。 </div> <div class="mw-translate-fuzzy"> 在 BTRFS 的世界里,卷这个词对应的是一个存储池 (ZFS) 或一个卷组 (LVM)。 </div> * ''设备'' - 一个或多个底层物理卷。 * ''卷'' - 一个大型存储池,由设备的所有空间组成,可支持不同的冗余级别。 * ''子卷'' - 这些是被挂载的部分,你可以在其中存储文件。 * ''快照'' - 子卷在某个时间点的只读副本和/或''子卷''在某个时间点的读写副本(也就是克隆)。 == 创建一个卷 == <div class="mw-translate-fuzzy"> 要创建一个基本的 BTRFS 卷,将需要一个额外的空盘。执行以下步骤: </div> {{console|body= # ##i## mkfs.btrfs /dev/sdxy btrfs-progs v4.17.1 See http://btrfs.wiki.kernel.org for more information. Detected a SSD, turning off metadata duplication. Mkfs with -m dup if you want to force metadata duplication. Performing full device TRIM /dev/sdj (223.57GiB) ... Label: (null) UUID: d6bcba6e-8fd5-41fc-9bb4-79628c5c928c Node size: 16384 Sector size: 4096 Filesystem size: 223.57GiB Block group profiles: Data: single 8.00MiB Metadata: single 8.00MiB System: single 4.00MiB SSD detected: yes Incompat features: extref, skinny-metadata Number of devices: 1 Devices: ID SIZE PATH 1 223.57GiB /dev/sdxy }} {{c|/dev/sdxy}} 应该是一个未使用的磁盘。如果这个磁盘上有任何已存在的数据,可能需要使用以下命令: {{console|body= # ##i## mkfs.btrfs -f /dev/sdxy }} 现在可以像挂载其他 linux 文件系统一样挂载所创建的卷。 {{console|body= # ##i## mkdir /mnt/btrfs-top-level # ##i## mount /dev/sdxy /mnt/btrfs-top-level # ##i## mount ... /dev/sdxy on /mnt/btrfs-top-level type btrfs (rw,relatime,ssd,space_cache,subvolid=5,subvol=/) }} {{Important|It is recommended that nothing is stored directly on this top-level volume (ID 5) root directory.}} == Creating Subvolumes == Btrfs has a concept of subvolumes. Subvolume is an independently mountable POSIX filetree (but not a block device). There are several basic schemas to layout subvolumes (including snapshots) as well as mixtures thereof. Lets create children of the top level subvolume (ID 5). We will have: * {{c|@data}} - it will serve as mountable {{c|/data}} * {{c|.snapshots}} - here snapshots will be stored {{console|body= # ##i## cd /mnt/btrfs-top-level # ##i## btrfs subvolume create @data # ##i## btrfs subvolume create .snapshots # ##i## btrfs subvolume list /mnt/btrfs-top-level ID 256 gen 322338 top level 5 path @data ID 257 gen 322275 top level 5 path .snapshots }} == The default Subvolume == {{Note|Changing the default subvolume with {{c|btrfs subvolume default}} will make the top level of the filesystem accessible only when {{c|subvol}} or {{c|subvolid}} mount options are specified}} When btrfs block device is mounted without specifying a subvolume the default one is used. To check default subvolume run {{console|body= # ##i## btrfs subvolume get-default /mnt/btrfs-top-level ID 5 (FS_TREE) }} For the convenience lets make {{c|@data}} subvolume as the default one. It's good to double check the subvolume ID first. Either {{c|btrfs subvolume list}} or {{c|btrfs subvolume show}} can be used for that {{console|body= # ##i## btrfs subvolume show /mnt/btrfs-top-level/@data ... Subvolume ID: 256 }} Now you can make this subvolume as a default one {{console|body= # ##i## btrfs subvolume set-default 256 /mnt/btrfs-top-level # ##i## btrfs subvolume get-default /mnt/btrfs-top-level ID 256 gen 322336 top level 5 path @data }} At this point you can stop working on the top level subvolume (ID 5) and instead mount directly {{c|@data}} subvolume. {{console|body= # ##i## cd /mnt # ##i## umount /mnt/btrfs-top-level # ##i## mkdir /data # ##i## mount /dev/sdxy /data }} == Nested Subvolumes == {{Note|Nested subvolumes are not going to be a part of snapshots created from their parent subvolume. So one typical reason is to exclude certain parts of the filesystem from being snapshot.}} Lets create a separate nested subvolume for {{c|/data/independent}}. {{console|body= # ##i## btrfs subvolume create /data/independent # ##i## btrfs subvolume list /data ID 258 gen 161 top level 256 path independent }} Usually you will want to "split" areas which are "complete" and/or "consistent" in themselves. Examples for this more-fine grained partitioning could be {{c|/var/log}}, {{c|/var/www}} or {{c|/var/lib/postgresql}}. == /etc/fstab == To automatically mount the {{c|@data}} subvolume after reboot you need to modify {{c|/etc/fstab}} {{file|name=/etc/fstab|desc=fstab for btrfs|body= /dev/sdxy /data btrfs subvolid=256,defaults 0 0 }} {{Warning|According to [https://btrfs.readthedocs.io/en/latest/Administration.html#mount-options btrfs docs] most mount options apply to the whole filesystem and only options in the first mounted subvolume will take effect. This means that (for example) you can't set per-subvolume {{c|nodatacow}}, {{c|nodatasum}}, or {{c|compress}}.}} Now lets verify if this changes were correct {{console|body= # ##i## cd / # ##i## umount /data # ##i## mount /data # ##i## ls /data independent }} Did you just notice that although we mounted our {{c|@data}} subvolume the nested subvolume {{c|@data/independent}} is also present? == Snapshots == For the purpose of checking out this cool btrfs feature lets populate our filesystem with some example data first {{console|body= # ##i## echo 'btrfs' > /data/foo.txt # ##i## echo 'fun' > /data/independent/bar.txt }} As you probably remember on the top level (next to {{c|@data}} subvolume) you've also created the {{c|.snapshots}} subvolume. You can mount it now to create some snapshots {{console|body= # ##i## mkdir /mnt/snapshots # ##i## mount /dev/sdxy /mnt/snapshots -o subvolid=257 }} A snapshot is a subvolume like any other, with given initial content. By default, snapshots are created read-write. File modifications in a snapshot do not affect the files in the original subvolume. Lets create a read-write snapshot for {{c|/data}} and read-only snapshot for {{c|/data/independent}} {{console|body= # ##i## btrfs subvolume snapshot /data /mnt/snapshots/data_$(date -u -Iseconds) Create a snapshot of '/data' in '/mnt/snapshots/data_2022-08-30T22:04:57+00:00' # ##i## btrfs subvolume snapshot -r /data/independent /mnt/snapshots/independent_$(date -u -Iseconds) Create a readonly snapshot of '/data/independent' in '/mnt/snapshots/independent_2022-08-30T22:05:29+00:00' }} Once again, nested subvolumes are not going to be a part of snapshots created from their parent subvolume. So you shouldn't be surprised when you compare the contents of the {{c|/data}} vs the contents of the {{c|/mnt/snapshots}} {{console|body= # ##i## tree /data /data ├── foo.txt └── independent └── bar.txt # ##i## tree /mnt/snapshots /mnt/snapshots ├── data_2022-08-30T22:04:57+00:00 │ └── foo.txt └── independent_2022-08-30T22:05:29+00:00 └── bar.txt }} At this point you might be interested in [https://btrfs.readthedocs.io/en/latest/Send-receive.html send and receive btrfs features]. {{Note|According to [https://btrfs.readthedocs.io/en/latest/Subvolumes.html btrfs docs] a snapshot is not a backup: snapshots work by use of BTRFS copy-on-write behaviour. A snapshot and the original it was taken from initially share all of the same data blocks. If that data is damaged in some way (cosmic rays, bad disk sector, accident with dd to the disk), then the snapshot and the original will both be damaged.}} == Wrap up == {{Important|It is recommended to run {{c|btrfs scrub}} once in a while. E.g. every month}} Scrub is the online check and repair functionality that verifies the integrity of data and metadata, assuming the tree structure is fine. You can run it on a mounted file system; it runs as a background process during normal operation. To start a (background) scrub on the filesystem which contains {{c|/data}} run {{console|body= # ##i## btrfs scrub start /data scrub started on /data, fsid 40f8b94f-07ee-4f7e-beb1-8e686abc246d (pid=5525) }} To check the status of a running scrub {{console|body= # ##i## btrfs scrub status /data UUID: 40f8b94f-07ee-4f7e-beb1-8e686abc246d Scrub started: Tue Aug 30 00:38:54 2022 Status: running Duration: 0:00:15 Time left: 0:00:34 ETA: Tue Aug 30 00:39:44 2022 Total to scrub: 149.06GiB Bytes scrubbed: 44.79GiB (30.04%) Rate: 2.99GiB/s Error summary: no errors found }} <div class="mw-translate-fuzzy"> 你现在应该已经到了可以开始使用 BTRFS 来完成各种任务的阶段。虽然 BTRFS 的内容比这篇简短的介绍要多得多,但你现在应该对 BTRFS 的基本概念有了很好的理解。 </div> <div class="mw-translate-fuzzy"> [[Category:BTRFS]] [[Category:Filesystems]] [[Category:HOWTO]] [[Category:Official Documentation]] </div>
Navigation menu
Personal tools
English
Log in
Namespaces
Translate
Variants
Views
Language statistics
Message group statistics
Export
More
Search
foo
Funtoo Linux
Install
Support Matrix
Download
Find your CPU
FAQ
Infrastructure
YouTube Channel
Discord
Report a Bug
Submit Code
Forums
Server Status
Sponsors
Projects
Keychain
Containers
Metro
Misc
Ebuilds
Wiki Editing Guidelines
Development Guide
Categories
Articles
HOWTOs
Tutorials
Networking
Portage
Links
Recent changes
MediaWiki Help
Tools
Special pages
Printable version