Linux Time Machine: NILFS 2

Source: Internet
Author: User

Linux Time Machine: NILFS 2

NILFS is intended for flash storage devices, but it can also be used on common mechanical disks. The biggest feature of NILFS is that it can "continuously" snapshot. This "continuously" refers to automatic and second-level, with no impact on application performance, for file systems that support snapshots such as LVM, ZFS, and BTRFS, snapshots are manually triggered, which affects application performance.

This is an NILFS experience On Debian:

$ Sudo apt install nilfs-tools
$ Cat/etc/nilfs_cleanerd.conf

$ Dd if =/dev/zero of = fs. img bs = 1 M count = 200
$ Mkfs-t nilfs2-L some-label fs. img
$ Sudo mount fs. img/mnt
$ Grep nilfs/proc/mounts
$ Nilfs-tune-l/dev/loop0

$ Sudo cp-r/etc/mnt
$ Sudo cp-r/etc/mnt/
$ Lscp
$ Sudo chcp ss/dev/loop0 2
$ Mkdir snapshot-2
$ Sudo mount-r-o cp = 2/dev/loop0 snapshot-2

$ Sudo rmcp 1

The old version of NILFS is said to have a bug. After the disk space is used up, it cannot be deleted because the snapshot cannot be created. However, it seems that the new version is fixed, and I cannot delete it after I reproduce the 100% usage, I use the root operation, so the reserved space can be used up, but it can still be deleted. "The problem" is whether the available disk space is zero after deletion. This is not a real problem, but it only requires nilfs-clean-p 1 s-r to tell nilfs-cleanerd not to keep the checkpoint one second ago, by default, it always retains checkpoints within one hour.

NILFS snapshot is actually a specially marked checkpoint (marked with the chcp command). snapshot cannot be rmcp or be gc, only snapshot can be read-only mounted (any checkpoint that has not been deleted can be changed to snapshot before being mounted). This design is also as expected. By default, the checkpoint earlier than one hour will be deprecated by gc, if you think a version is important, you can mark it as snapshot.

In addition, it is observed that the checkpoint is automatically created in seconds and does not generate a checkpoint for every write. This can also be understood that the checkpoint in milliseconds is generally unnecessary.

The checkpoint is also important and unimportant. It is probably an important checkpoint when the write is stopped. By default, lscp only displays the important checkpoint. This design is very considerate.

Note that NILFS snapshots are read-only and cannot be written. They do not support "rollback" file system modifications (unless you copy all the copies of rsync after mounting snapshot ), NILFS is mainly used to prevent accidental deletion and modification of files and audit the file system.

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.