Linux command
btrfs-restore 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Restore
sudo btrfs restore [path/to/btrfs_device] [path/to/target_directory]
List files
sudo btrfs restore -D [path/to/btrfs_device] [path/to/target_directory]
Example
sudo btrfs restore --path-regex [regex] -c [path/to/btrfs_device] [path/to/target_directory]
Example
sudo btrfs restore -t [bytenr] [path/to/btrfs_device] [path/to/target_directory]
Example
sudo btrfs restore -m -x -S -o [path/to/btrfs_device] [path/to/target_directory]
说明
btrfs restore attempts to salvage files from a damaged btrfs filesystem that cannot be mounted normally. It reads filesystem structures directly from the device and copies recoverable files to a target directory. This is a data recovery tool for when other methods fail. It does not repair the filesystem; it extracts data to a healthy location.
参数
- -D, --dry-run
- List files without extracting
- --path-regex _regex_
- Only restore files matching pattern
- -c
- Case-insensitive regex matching
- -t _bytenr_
- Use specific root tree (see btrfs-find-root)
- -m, --metadata
- Restore metadata (permissions, times)
- -x, --xattr
- Restore extended attributes
- -S, --symlinks
- Restore symbolic links
- -o, --overwrite
- Overwrite existing files in target
- -v
- Verbose output
FAQ
What is the btrfs-restore command used for?
btrfs restore attempts to salvage files from a damaged btrfs filesystem that cannot be mounted normally. It reads filesystem structures directly from the device and copies recoverable files to a target directory. This is a data recovery tool for when other methods fail. It does not repair the filesystem; it extracts data to a healthy location.
How do I run a basic btrfs-restore example?
Run `sudo btrfs restore [path/to/btrfs_device] [path/to/target_directory]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -D, --dry-run do in btrfs-restore?
List files without extracting