Чем файловая система COW лучше файловой системы журналирования?

Чтобы ответить на ваш вопрос, как написано, вы можете сделать следующее:

#!/bin/bash

for file in /path/to/files/*.txt; do
    # This will loop through each.txt file in the directory
    # setting the full file path to $file
    # I recommend adding the.txt if you know all your files
    # will have that extension otherwise the following is fine:
    # for file in /path/to/files/*; do
    while read -r line; do
        # This will loop through each line of the current file
        # and set the full line to the $line variable
        command "$line"
    done < "$file"
done

Пояснения в комментариях внутри кода

0
12.02.2021, 09:46
1 ответ

Изhttps://lwn.net/Articles/576276/

When data is overwritten in an ext4 filesystem, the new data is written on top of the existing data on the storage device, destroying the old copy. Btrfs, instead, will move overwritten blocks elsewhere in the filesystem and write the new data there, leaving the older copy of the data in place.

The COW mode of operation brings some significant advantages. Since old data is not overwritten, recovery from crashes and power failures should be more straightforward; if a transaction has not completed, the previous state of the data (and metadata) will be where it always was. So, among other things, a COW filesystem does not need to implement a separate journal to provide crash resistance.

2
18.03.2021, 22:30

Теги

Похожие вопросы