Merge pull request #9023 from geekpi/master

translated
This commit is contained in:
geekpi 2018-06-04 08:51:53 +08:00 committed by GitHub
commit 6b6b26d994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 134 additions and 136 deletions

View File

@ -1,136 +0,0 @@
translating----geekpi
Using Stratis to manage Linux storage from the command line
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/find-file-linux-code_magnifying_glass_zero.png?itok=E2HoPDg0)
As discussed in [Part 1][1] and [Part 2][2] of this series, Stratis is a volume-managing filesystem with functionality similar to that of [ZFS][3] and [Btrfs][4]. In this article, we'll walk through how to use Stratis on the command line.
### Getting Stratis
For non-developers, the easiest way to try Stratis now is in [Fedora 28][5].
Once you're running this, you can install the Stratis daemon and the Stratis command-line tool with:
```
# dnf install stratis-cli stratisd
```
### Creating a pool
Stratis has three concepts: blockdevs, pools, and filesystems. Blockdevs are the block devices, such as a disk or a disk partition, that make up a pool. Once a pool is created, filesystems can be created from it.
Assuming you have a block device called `vdg` on your system that is not currently in use or mounted, you can create a Stratis pool on it with:
```
# stratis pool create mypool /dev/vdg
```
This assumes `vdg` is completely zeroed and empty. If it is not in use but has old data on it, it may be necessary to use `pool create`'s `- force` option. If it is in use, don't use it for Stratis.
If you want to create a pool from more than one block device, just list them all on the `pool create` command line. You can also add more blockdevs later using the `blockdev add-data` command. Note that Stratis requires blockdevs to be at least 1 GiB in size.
### Creating filesystems
Once you've created a pool called `mypool`, you can create filesystems from it:
```
# stratis fs create mypool myfs1
```
After creating a filesystem called `myfs1` from pool `mypool`, you can mount and use it, using the entries Stratis has created within /dev/stratis:
```
# mkdir myfs1
# mount /dev/stratis/mypool/myfs1 myfs1
```
The filesystem is now mounted on `myfs1` and ready to use.
### Snapshots
In addition to creating empty filesystems, you can also create a filesystem as a snapshot of an existing filesystem:
```
# stratis fs snapshot mypool myfs1 myfs1-experiment
```
After doing so, you could mount the new `myfs1-experiment`, which will initially contain the same file contents as `myfs1`, but could change as the filesystem is modified. Whatever changes you made to `myfs1-experiment` would not be reflected in `myfs1` unless you unmounted `myfs1` and destroyed it with:
```
# umount myfs1
# stratis fs destroy mypool myfs1
```
and then snapshotted the snapshot to recreate it and remounted it:
```
# stratis fs snapshot mypool myfs1-experiment myfs1
# mount /dev/stratis/mypool/myfs1 myfs1
```
### Getting information
Stratis can list pools on the system:
```
# stratis pool list
```
As filesystems have more data written to them, you will see the "Total Physical Used" value increase. Be careful when this approaches "Total Physical Size"; we're still working on handling this correctly.
To list filesystems within a pool:
```
# stratis fs list mypool
```
To list the blockdevs that make up a pool:
```
# stratis blockdev list mypool
```
These give only minimal information currently, but they will provide more in the future.
#### Destroying a pool
Once you have an idea of what Stratis can do, to destroy the pool, first make sure all filesystems created from it are unmounted and destroyed, then use the `pool destroy` command:
```
# umount myfs1
# umount myfs1-experiment (if you created it)
# stratis fs destroy mypool myfs1
# stratis fs destroy mypool myfs1-experiment
# stratis pool destroy mypool
```
`stratis pool list` should now show no pools.
That's it! For more information, please see the manpage: `man stratis`.
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/5/stratis-storage-linux-command-line
作者:[Andy Grover][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/agrover
[1]:https://opensource.com/article/18/4/stratis-easy-use-local-storage-management-linux
[2]:https://opensource.com/article/18/4/stratis-lessons-learned
[3]:https://en.wikipedia.org/wiki/ZFS
[4]:https://en.wikipedia.org/wiki/Btrfs
[5]:https://fedoraproject.org/wiki/Releases/28/Schedule

View File

@ -0,0 +1,134 @@
使用 Stratis 从命令行管理 Linux 存储
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/find-file-linux-code_magnifying_glass_zero.png?itok=E2HoPDg0)
正如本系列的[第一部分][1]和[第二部分][2]中所讨论的Stratis 是一个具有与 [ZFS][3] 和 [Btrfs] [4] 相似功能的卷管理文件系统。在本文中,我们将介绍如何在命令行上使用 Stratis。
### 安装 Stratis
对于非开发人员,现在尝试 Stratis 最简单的方法是在 [Fedora 28][5] 中。
你可以用以下命令安装 Stratis 守护进程和 Stratis 命令行工具:
```
# dnf install stratis-cli stratisd
```
### 创建一个池
Stratis 有三个概念blockdevs、池和文件系统。 Blockdevs 是组成池的块设备,例如磁盘或磁盘分区。一旦创建池,就可以从中创建文件系统。
假设你的系统上有一个名为 `vdg` 的块设备,它目前没有被使用或挂载,你可以在它上面创建一个 Stratis 池:
```
# stratis pool create mypool /dev/vdg
```
这假设 `vdg` 是完全清零并且是空的。如果它没有被使用,但有旧数据,则可能需要使用 `pool create`` - force` 选项。如果正在使用,请勿将它用于 Stratis。
如果你想从多个块设备创建一个池,只需在 `pool create` 命令行中列出它们。你也可以稍后使用 `blockdev add-data` 命令添加更多的 blockdevs。请注意Stratis 要求 blockdevs 的大小至少为 1 GiB。
### 创建文件系统
在你创建了一个名为 `mypool` 的池后,你可以从它创建文件系统:
```
# stratis fs create mypool myfs1
```
`mypool` 池创建一个名为 `myfs1` 的文件系统后,可以使用 Stratis 在 /dev/stratis 中创建的条目来挂载并使用它:
```
# mkdir myfs1
# mount /dev/stratis/mypool/myfs1 myfs1
```
文件系统现在已被挂载在 `myfs1` 上并准备可以使用。
### 快照
除了创建空文件系统之外,你还可以创建一个文件系统作为现有文件系统的快照:
```
# stratis fs snapshot mypool myfs1 myfs1-experiment
```
这样做后,你可以挂载新的 `myfs1-experiment`,它将初始包含与 `myfs1` 相同的文件内容,但它可能随着文件系统的修改而改变。无论你对 `myfs1-experiment` 所做的任何更改都不会反映到 `myfs1` 中,除非你卸载了 `myfs1` 并将其销毁:
```
# umount myfs1
# stratis fs destroy mypool myfs1
```
然后进行快照以重新创建并重新挂载它:
```
# stratis fs snapshot mypool myfs1-experiment myfs1
# mount /dev/stratis/mypool/myfs1 myfs1
```
### 获取信息
Stratis 可以列出系统中的池:
```
# stratis pool list
```
随着文件系统写入更多数据,你将看到 “Total Physical Used” 值的增加。当这个值接近 “Total Physical Size” 时要小心。我们仍在努力处理这个问题。
列出池中的文件系统:
```
# stratis fs list mypool
```
列出组成池的 blockdevs
```
# stratis blockdev list mypool
```
目前只提供这些最少的信息,但它们将在未来提供更多信息。
#### 摧毁池
当你了解了 Stratis 可以做什么后,要摧毁池,首先确保从它创建的所有文件系统都被卸载并销毁,然后使用 `pool destroy` 命令:
```
# umount myfs1
# umount myfs1-experiment (if you created it)
# stratis fs destroy mypool myfs1
# stratis fs destroy mypool myfs1-experiment
# stratis pool destroy mypool
```
`stratis pool list` 现在应该显示没有池。
就是这些有关更多信息请参阅手册页“man stratis”。
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/5/stratis-storage-linux-command-line
作者:[Andy Grover][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/agrover
[1]:https://opensource.com/article/18/4/stratis-easy-use-local-storage-management-linux
[2]:https://opensource.com/article/18/4/stratis-lessons-learned
[3]:https://en.wikipedia.org/wiki/ZFS
[4]:https://en.wikipedia.org/wiki/Btrfs
[5]:https://fedoraproject.org/wiki/Releases/28/Schedule