mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
translating
This commit is contained in:
parent
9f2a56309a
commit
4737261032
@ -1,147 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Using mergerfs to increase your virtual storage)
|
||||
[#]: via: (https://fedoramagazine.org/using-mergerfs-to-increase-your-virtual-storage/)
|
||||
[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/)
|
||||
|
||||
Using mergerfs to increase your virtual storage
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
What happens if you have multiple disks or partitions that you’d like to use for a media project and you don’t want to lose any of your existing data, but you’d like to have everything located or mounted under one drive. That’s where mergerfs can come to your rescue!
|
||||
|
||||
[mergerfs][2] is a union filesystem geared towards simplifying storage and management of files across numerous commodity storage devices.
|
||||
|
||||
You will need to grab the latest RPM from their github page [here][3]. The releases for Fedora have _**fc**_ and the version number in the name. For example here is the version for Fedora 31:
|
||||
|
||||
[mergerfs-2.29.0-1.fc31.x86_64.rpm][4]
|
||||
|
||||
### Installing and configuring mergerfs
|
||||
|
||||
Install the mergerfs package that you’ve downloaded using sudo:
|
||||
|
||||
```
|
||||
$ sudo dnf install mergerfs-2.29.0-1.fc31.x86_64.rpm
|
||||
```
|
||||
|
||||
You will now be able to mount multiple disks as one drive. This comes in handy if you have a media server and you’d like all of your media files to show up under one location. If you upload new files to your system, you can copy them to your mergerfs directory and mergerfs will automatically copy them to which ever drive has enough free space available.
|
||||
|
||||
Here is an example to make it easier to understand:
|
||||
|
||||
```
|
||||
$ df -hT | grep disk
|
||||
/dev/sdb1 ext4 23M 386K 21M 2% /disk1
|
||||
/dev/sdc1 ext4 44M 1.1M 40M 3% /disk2
|
||||
|
||||
$ ls -l /disk1/Videos/
|
||||
total 1
|
||||
-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv
|
||||
|
||||
$ ls -l /disk2/Videos/
|
||||
total 2
|
||||
-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv
|
||||
-rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv
|
||||
```
|
||||
|
||||
In this example there are two disks mounted as _disk1_ and _disk2_. Both drives have a _**Videos**_ directory with existing files.
|
||||
|
||||
Now we’re going to mount those drives using mergerfs to make them appear as one larger drive.
|
||||
|
||||
```
|
||||
$ sudo mergerfs -o defaults,allow_other,use_ino,category.create=mfs,moveonenospc=true,minfreespace=1M /disk1:/disk2 /media
|
||||
```
|
||||
|
||||
The mergerfs man page is quite extensive and complex so we’ll break down the options that were specified.
|
||||
|
||||
* _defaults_: This will use the default settings unless specified.
|
||||
* _allow_other_: allows users besides sudo or root to see the filesystem.
|
||||
* _use_ino_: Causes mergerfs to supply file/directory inodes rather than libfuse. While not a default it is recommended it be enabled so that linked files share the same inode value.
|
||||
* _category.create=mfs_: Spreads files out across your drives based on available space.
|
||||
* _moveonenospc=true_: If enabled, if writing fails, a scan will be done looking for the drive with the most free space.
|
||||
* _minfreespace=1M_: The minimum space value used.
|
||||
* _disk1_: First hard drive.
|
||||
* _disk2_: Second hard drive.
|
||||
* _/media_: The directory folder where the drives are mounted.
|
||||
|
||||
|
||||
|
||||
Here is what it looks like:
|
||||
|
||||
```
|
||||
$ df -hT | grep disk
|
||||
/dev/sdb1 ext4 23M 386K 21M 2% /disk1
|
||||
/dev/sdc1 ext4 44M 1.1M 40M 3% /disk2
|
||||
|
||||
$ df -hT | grep media
|
||||
1:2 fuse.mergerfs 66M 1.4M 60M 3% /media
|
||||
```
|
||||
|
||||
You can see that the mergerfs mount now shows a total capacity of 66M which is the combined total of the two hard drives.
|
||||
|
||||
Continuing with the example:
|
||||
|
||||
There is a 30Mb video called _Baby’s second Xmas.mkv_. Let’s copy it to the _/media_ folder which is the mergerfs mount.
|
||||
|
||||
```
|
||||
$ ls -lh "Baby's second Xmas.mkv"
|
||||
-rw-rw-r--. 1 curt curt 30M Apr 20 08:45 Baby's second Xmas.mkv
|
||||
$ cp "Baby's second Xmas.mkv" /media/Videos/
|
||||
```
|
||||
|
||||
Here is the end result:
|
||||
|
||||
```
|
||||
$ df -hT | grep disk
|
||||
/dev/sdb1 ext4 23M 386K 21M 2% /disk1
|
||||
/dev/sdc1 ext4 44M 31M 9.8M 76% /disk2
|
||||
|
||||
$ df -hT | grep media
|
||||
1:2 fuse.mergerfs 66M 31M 30M 51% /media
|
||||
```
|
||||
|
||||
You can see from the disk space utilization that mergerfs automatically copied the file to disk2 because disk1 did not have enough free space.
|
||||
|
||||
Here is a breakdown of all of the files:
|
||||
|
||||
```
|
||||
$ ls -l /disk1/Videos/
|
||||
total 1
|
||||
-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv
|
||||
|
||||
$ ls -l /disk2/Videos/
|
||||
total 30003
|
||||
-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv
|
||||
-rw-rw-r--. 1 curt curt 30720000 Apr 20 08:47 Baby's second Xmas.mkv
|
||||
-rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv
|
||||
|
||||
$ ls -l /media/Videos/
|
||||
total 30004
|
||||
-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv
|
||||
-rw-rw-r--. 1 curt curt 30720000 Apr 20 08:47 Baby's second Xmas.mkv
|
||||
-rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv
|
||||
-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv
|
||||
```
|
||||
|
||||
When you copy files to your mergerfs mount, it will always copy the files to the hard disk that has enough free space. If none of the drives in the pool have enough free space, then you won’t be able to copy them.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/using-mergerfs-to-increase-your-virtual-storage/
|
||||
|
||||
作者:[Curt Warfield][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/rcurtiswarfield/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/mergerfs-816x346.png
|
||||
[2]: https://github.com/trapexit/mergerfs
|
||||
[3]: https://github.com/trapexit/mergerfs/releases
|
||||
[4]: https://github.com/trapexit/mergerfs/releases/download/2.29.0/mergerfs-2.29.0-1.fc31.x86_64.rpm
|
@ -0,0 +1,147 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Using mergerfs to increase your virtual storage)
|
||||
[#]: via: (https://fedoramagazine.org/using-mergerfs-to-increase-your-virtual-storage/)
|
||||
[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/)
|
||||
|
||||
使用 mergefs 增加虚拟存储
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
如果你想在一个媒体项目中用上多个磁盘或分区,而又不想丢失任何现有数据,但又想将所有文件都存放在一个驱动器下,该怎么办?这就是 mergefs 派上用场的地方!
|
||||
|
||||
[mergerfs][2] 是旨在简化跨多个商业存储设备文件的存储和管理的联合文件系统。
|
||||
|
||||
你需要从[这个][3] github 页面获取最新的 RPM。Fedora 的版本名称中带有 _**fc**_ 和版本号。例如,以下是 Fedora 31 的版本:
|
||||
|
||||
[mergerfs-2.29.0-1.fc31.x86_64.rpm][4]
|
||||
|
||||
### 安装和配置 mergefs
|
||||
|
||||
使用 sudo 安装已下载的 mergefs 软件包:
|
||||
|
||||
```
|
||||
$ sudo dnf install mergerfs-2.29.0-1.fc31.x86_64.rpm
|
||||
```
|
||||
|
||||
现在,你可以将多个磁盘挂载为一个驱动器。如果你有一台媒体服务器,并且希望所有媒体文件都显示在一个地方,这将很方便。如果将新文件上传到系统,那么可以将它们复制到 mergefs 目录,mergefs 会自动将它们复制具有足够可用空间的磁盘上。
|
||||
|
||||
这是使你更容易理解的例子:
|
||||
|
||||
```
|
||||
$ df -hT | grep disk
|
||||
/dev/sdb1 ext4 23M 386K 21M 2% /disk1
|
||||
/dev/sdc1 ext4 44M 1.1M 40M 3% /disk2
|
||||
|
||||
$ ls -l /disk1/Videos/
|
||||
total 1
|
||||
-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv
|
||||
|
||||
$ ls -l /disk2/Videos/
|
||||
total 2
|
||||
-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv
|
||||
-rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv
|
||||
```
|
||||
|
||||
在此例中挂载了两块磁盘,分别为 _disk1_ 和 _disk2_。两个驱动器都有一个包含文件的 _**Videos**_ 目录。
|
||||
|
||||
现在,我们将使用 mergefs 挂载这些驱动器,使它们看起来像一个更大的驱动器。
|
||||
|
||||
```
|
||||
$ sudo mergerfs -o defaults,allow_other,use_ino,category.create=mfs,moveonenospc=true,minfreespace=1M /disk1:/disk2 /media
|
||||
```
|
||||
|
||||
mergefs 手册页非常广泛且复杂,因此我们将说明上面提到的选项。
|
||||
|
||||
* _defaults_:除非指定,否则将使用默认设置。
|
||||
* _allow_other_:允许 sudo 或 root 以外的用户查看文件系统。
|
||||
* _use_ino_:让 mergefs 提供文件/目录 inode 而不是 libfuse。虽然不是默认值,但建议你启用它,以便链接的文件共享相同的 inode 值。
|
||||
* _category.create=mfs_:根据可用空间在驱动器间传播文件。
|
||||
* _moveonenospc=true_:如果启用,那么如果写入失败,将进行扫描以查找具有最大可用空间的驱动器。
|
||||
* _minfreespace=1M_:最小使用空间值。
|
||||
* _disk1_:第一块硬盘。
|
||||
* _disk2_:第二块硬盘。
|
||||
* _/media_:挂载驱动器的目录。
|
||||
|
||||
|
||||
|
||||
看起来是这样的:
|
||||
|
||||
```
|
||||
$ df -hT | grep disk
|
||||
/dev/sdb1 ext4 23M 386K 21M 2% /disk1
|
||||
/dev/sdc1 ext4 44M 1.1M 40M 3% /disk2
|
||||
|
||||
$ df -hT | grep media
|
||||
1:2 fuse.mergerfs 66M 1.4M 60M 3% /media
|
||||
```
|
||||
|
||||
你可以看到现在 mergefs 挂载显示的总容量为 66M,这是两块硬盘的总容量。
|
||||
|
||||
继续示例:
|
||||
|
||||
有一个叫 _Baby’s second Xmas.mkv_ 的 30M 视频。让我们将其复制到用 mergerfs 挂载的 _/media_ 文件夹中。
|
||||
|
||||
```
|
||||
$ ls -lh "Baby's second Xmas.mkv"
|
||||
-rw-rw-r--. 1 curt curt 30M Apr 20 08:45 Baby's second Xmas.mkv
|
||||
$ cp "Baby's second Xmas.mkv" /media/Videos/
|
||||
```
|
||||
|
||||
这是最终结果:
|
||||
|
||||
```
|
||||
$ df -hT | grep disk
|
||||
/dev/sdb1 ext4 23M 386K 21M 2% /disk1
|
||||
/dev/sdc1 ext4 44M 31M 9.8M 76% /disk2
|
||||
|
||||
$ df -hT | grep media
|
||||
1:2 fuse.mergerfs 66M 31M 30M 51% /media
|
||||
```
|
||||
|
||||
从磁盘空间利用率中可以看到,因为 disk1 没有足够的可用空间,所以 mergefs 自动将文件复制到 disk2。
|
||||
|
||||
这是所有文件详情:
|
||||
|
||||
```
|
||||
$ ls -l /disk1/Videos/
|
||||
total 1
|
||||
-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv
|
||||
|
||||
$ ls -l /disk2/Videos/
|
||||
total 30003
|
||||
-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv
|
||||
-rw-rw-r--. 1 curt curt 30720000 Apr 20 08:47 Baby's second Xmas.mkv
|
||||
-rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv
|
||||
|
||||
$ ls -l /media/Videos/
|
||||
total 30004
|
||||
-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv
|
||||
-rw-rw-r--. 1 curt curt 30720000 Apr 20 08:47 Baby's second Xmas.mkv
|
||||
-rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv
|
||||
-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv
|
||||
```
|
||||
|
||||
当你将文件复制到 mergefs 挂载点时,它将始终将文件复制到有足够可用空间的硬盘上。如果池中的所有驱动器都没有足够的可用空间,那么你将无法复制它们。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/using-mergerfs-to-increase-your-virtual-storage/
|
||||
|
||||
作者:[Curt Warfield][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/rcurtiswarfield/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/mergerfs-816x346.png
|
||||
[2]: https://github.com/trapexit/mergerfs
|
||||
[3]: https://github.com/trapexit/mergerfs/releases
|
||||
[4]: https://github.com/trapexit/mergerfs/releases/download/2.29.0/mergerfs-2.29.0-1.fc31.x86_64.rpm
|
Loading…
Reference in New Issue
Block a user