mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
8222c29f6a
@ -1,8 +1,8 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12195-1.html)
|
||||
[#]: subject: (Upgrading Fedora 31 to Fedora 32)
|
||||
[#]: via: (https://fedoramagazine.org/upgrading-fedora-31-to-fedora-32/)
|
||||
[#]: author: (Adam Šamalík https://fedoramagazine.org/author/asamalik/)
|
||||
@ -12,27 +12,27 @@
|
||||
|
||||
![][1]
|
||||
|
||||
Fedora 32 [已经发布][2]。你可能想升级系统以获得 Fedora 中的最新功能。Fedora Workstation 有图形化的升级方法。另外,Fedora 提供了命令行方法,用于将 Fedora 30 升级到 Fedora 31。
|
||||
Fedora 32 [已经发布][2]。你可能想升级系统以获得 Fedora 中的最新功能。Fedora Workstation 有图形化的升级方法。另外,Fedora 提供了命令行方法,用于将 Fedora 31 升级到 Fedora 32。
|
||||
|
||||
升级前,请访问 [Fedora 32 个常见 bug 的维基页面] [3],查看是否存在可能影响升级的问题。尽管 Fedora 社区试图确保升级正常进行,但是无法为用户可能使用的每种软硬件组合提供保证。
|
||||
升级前,请访问 [Fedora 32 个常见 bug 的维基页面][3],查看是否存在可能影响升级的问题。尽管 Fedora 社区试图确保升级正常进行,但是无法为用户可能使用的每种软硬件组合提供保证。
|
||||
|
||||
### 将Fedora 31 Workstation 升级到 Fedora 32
|
||||
### 将 Fedora 31 Workstation 升级到 Fedora 32
|
||||
|
||||
发布不久之后就会出现通知,告诉你有可用的升级。你可以单击通知启动 **GNOME Software**。或者,你可以从 GNOME Shell 中选择“软件”。
|
||||
在新版本发布不久之后就会出现通知,告诉你有可用的升级。你可以单击该通知启动 “GNOME 软件”。或者,你可以从 GNOME Shell 中选择“软件”。
|
||||
|
||||
在 GNOME Software中 选择 _Updates_ 选项卡,你会看到一个页面通知你 Fedora 32 现在可用。
|
||||
在 “GNOME 软件”中选择<ruby>更新<rt>Updates</rt></ruby>选项卡,你会看到一个页面通知你 Fedora 32 现在可用。
|
||||
|
||||
如果你在此页面看不到任何内容,请尝试使用左上方的重新加载按钮。发布后,所有系统可能都需要一段时间才能看到可用的升级。
|
||||
|
||||
选择 _Download_ 获取升级包。你可以继续做事直到下载完成。然后使用 GNOME Software 重启系统并应用升级。升级需要时间,因此你可能需要喝杯咖啡,稍后再回来。
|
||||
选择<ruby>下载<rt>Download</rt></ruby>获取升级包。你可以继续做事直到下载完成。然后使用 “GNOME 软件”重启系统并应用升级。升级需要时间,因此你可能需要喝杯咖啡,稍后再回来。
|
||||
|
||||
### 使用命令行
|
||||
|
||||
如果你是从 Fedora 的先前版本升级的,那么你可能对 _dnf upgrade_ 插件很熟悉。此方法是从 Fedora 31 升级到 Fedora 32 的推荐和受支持的方法。使用此插件将使你轻松地升级到 Fedora 32。
|
||||
如果你是从 Fedora 的先前版本升级的,那么你可能对 `dnf upgrade` 插件很熟悉。这个方法是推荐和受支持的从 Fedora 31 升级到 Fedora 32 的方法。使用此插件将使你轻松地升级到 Fedora 32。
|
||||
|
||||
#### 1\. 更新软件并备份系统
|
||||
#### 1、更新软件并备份系统
|
||||
|
||||
在开始升级过程之前,请确保你有 Fedora 31 的最新软件。如果你安装了模块化软件,这尤为重要。dnf 和 GNOME Software 的最新版本对某些模块化流的升级过程进行了改进。要更新软件,请使用_ GNOME Software_ 或在终端中输入以下命令。
|
||||
在开始升级过程之前,请确保你有 Fedora 31 的最新软件。如果你安装了<ruby>模块化软件<rt>modular software</rt></ruby>,这尤为重要。`dnf` 和 “GNOME 软件”的最新版本对某些模块化流的升级过程进行了改进。要更新软件,请使用 “GNOME 软件” 或在终端中输入以下命令。
|
||||
|
||||
```
|
||||
sudo dnf upgrade --refresh
|
||||
@ -40,7 +40,7 @@ sudo dnf upgrade --refresh
|
||||
|
||||
此外,在继续操作之前,请确保备份系统。有关备份的帮助,请参阅 Fedora Magazine 上的[备份系列][4]。
|
||||
|
||||
#### 2\. 安装 DNF 插件
|
||||
#### 2、安装 DNF 插件
|
||||
|
||||
接下来,打开终端并输入以下命令安装插件:
|
||||
|
||||
@ -48,7 +48,7 @@ sudo dnf upgrade --refresh
|
||||
sudo dnf install dnf-plugin-system-upgrade
|
||||
```
|
||||
|
||||
#### 3\. 使用 DNF 开始更新
|
||||
#### 3、使用 DNF 开始更新
|
||||
|
||||
现在,你的系统已更新、已备份、并且已安装 DNF 插件,你可以在终端中使用以下命令开始升级:
|
||||
|
||||
@ -56,17 +56,17 @@ sudo dnf install dnf-plugin-system-upgrade
|
||||
sudo dnf system-upgrade download --releasever=32
|
||||
```
|
||||
|
||||
该命令将开始在本地下载计算机的所有升级,以准备升级。如果由于没有更新的软件包、损坏的依赖项或已淘汰的软件包而在升级时遇到问题,请在输入上述命令时添加 _‐allowerasing_ 标志。这将使 DNF 删除可能阻止系统升级的软件包。
|
||||
这个命令将开始在本地下载所有的升级包,为升级做准备。如果你在升级的时候因为没有更新的包、依赖关系破损或退役的包而出现问题,请在输入上述命令时添加 `--allowerasing` 标志。这将允许 DNF 移除可能阻碍系统升级的软件包。
|
||||
|
||||
#### 4\. 重启并升级
|
||||
#### 4、重启并升级
|
||||
|
||||
当上一个命令完成了所有升级的下载,你的系统就可以重新启动了。要将系统引导至升级过程,请在终端中输入以下命令:
|
||||
当上一个命令完成了所有升级包的下载,你的系统就可以重新启动了。要将系统引导至升级过程,请在终端中输入以下命令:
|
||||
|
||||
```
|
||||
sudo dnf system-upgrade reboot
|
||||
```
|
||||
|
||||
此后,系统将重启。在许多版本之前,_fedup_ 工具会在内核选择/引导页上创建一个新选项。使用 _dnf-plugin-system-upgrade_ 包,你的系统将重启进入 Fedora 31 当前安装的内核;这个是正常的。在选择内核之后,你的系统会立即开始升级过程。
|
||||
此后,系统将重启。在许多版本之前,`fedup` 工具会在内核选择/启动页上创建一个新选项。使用 `dnf-plugin-system-upgrade` 包,你的系统会重启进入 Fedora 31 当前安装的内核;这个是正常的。在选择内核之后,你的系统会立即开始升级过程。
|
||||
|
||||
现在可能是喝杯咖啡休息的好时机!完成后,系统将重启,你将能够登录到新升级的 Fedora 32 系统。
|
||||
|
||||
@ -85,14 +85,14 @@ via: https://fedoramagazine.org/upgrading-fedora-31-to-fedora-32/
|
||||
作者:[Adam Šamalík][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/asamalik/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/31-32-816x345.png
|
||||
[2]: https://fedoramagazine.org/announcing-fedora-32/
|
||||
[2]: https://linux.cn/article-12164-1.html
|
||||
[3]: https://fedoraproject.org/wiki/Common_F32_bugs
|
||||
[4]: https://fedoramagazine.org/taking-smart-backups-duplicity/
|
||||
[5]: https://cdn.fedoramagazine.org/wp-content/uploads/2016/06/Screenshot_f23-ws-upgrade-test_2016-06-10_110906-1024x768.png
|
@ -0,0 +1,165 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (lxbwolf)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12193-1.html)
|
||||
[#]: subject: (Drop PNG and JPG for your online images: Use WebP)
|
||||
[#]: via: (https://opensource.com/article/20/4/webp-image-compression)
|
||||
[#]: author: (Jeff Macharyas https://opensource.com/users/jeffmacharyas)
|
||||
|
||||
线上图片请抛弃 PNG 和 JPG:使用 WebP
|
||||
======
|
||||
|
||||
> 了解一下这个开源的图片编辑工具来节省时间和空间。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202005/07/143932l22hot7ebhbbqjmm.jpg)
|
||||
|
||||
WebP 是 2010 年 Google 开发的一种图片格式,它为网页上的图片提供了卓越的无损和有损压缩。网站开发者们可以使用 WebP 来创建尺寸更小、细节更丰富的图片,以此来提高网站的速度。更快的加载速度对于网站的用户体验和网站的营销效果是至关重要的。
|
||||
|
||||
为了在所有设备和用户中达到最佳加载效果,你网站上的图片文件大小不应该超过 500 KB。
|
||||
|
||||
与 PNG 图片相比,WebP 无损图片通常至少要比 PNG 图片小 25%。在同等的 SSIM(<ruby>结构相似度<rt>structural similarity</rt></ruby>)质量指标下,WebP 有损图片通常比 JPEG 图片小 25% 到 34%。
|
||||
|
||||
无损 WebP 也支持透明度。而在可接受有损 RGB 压缩的情况下,有损 WebP 也支持透明度,通常其大小比 PNG 文件小三倍。
|
||||
|
||||
Google 报告称,把动画 GIF 文件转换为有损 WebP 后文件大小减少了 64%,转换为无损 WebP 后文件大小减少了 19%。
|
||||
|
||||
WebP 文件格式是一种基于 RIFF(<ruby>资源互换文件格式<rt>resource interchange file format</rt></ruby>)的文档格式。你可以用 [hexdump][2] 看到文件的签名是 `52 49 46 46`(RIFF):
|
||||
|
||||
|
||||
```
|
||||
$ hexdump --canonical pixel.webp
|
||||
00000000 52 49 46 46 26 00 00 00 [...] |RIFF&...WEBPVP8 |
|
||||
00000010 1a 00 00 00 30 01 00 9d [...] |....0....*......|
|
||||
00000020 0e 25 a4 00 03 70 00 fe [...] |.%...p...`....|
|
||||
0000002e
|
||||
```
|
||||
|
||||
独立的 libwebp 库作为 WebP 技术规范的参考实现,可以从 Google 的 [Git 仓库][3] 或 tar 包中获得。
|
||||
|
||||
全球在用的 80% 的 web 浏览器兼容 WebP 格式。本文撰写时,Apple 的 Safari 浏览器还不兼容。解决这个问题的方法是将 JPG/PNG 图片与 WebP 图片一起提供,有一些方法和 Wordpress 插件可以做到这一点。
|
||||
|
||||
### 为什么要这样做?
|
||||
|
||||
我的部分工作是设计和维护我们组织的网站。由于网站是个营销工具,而网站的速度是衡量用户体验的重要指标,我一直致力于提高网站速度,通过把图片转换为 WebP 来减少图片大小是一个很好的解决方案。
|
||||
|
||||
我使用了 web.dev 来检测其中一个网页,该工具是由 Lighthouse 提供服务的,遵循 Apache 2.0 许可证,可以在 <https://github.com/GoogleChrome/lighthouse> 找到。
|
||||
|
||||
据其官方描述,“LIghthouse 是一个开源的,旨在提升网页质量的自动化工具。你可以在任何公共的或需要鉴权的网页上运行它。它有性能、可用性、渐进式 web 应用、SEO 等方面的审计。你可以在 Chrome 浏览器的开发工具中运行 Lighthouse,也可以通过命令行或作为 Node 模块运行。你输入一个 URL 给 Lighthouse,它会对这个网页进行一系列的审计,然后生成这个网页的审计结果报告。从报告的失败审计条目中可以知道应该怎么优化网页。每条审计都有对应的文档解释为什么该项目是重要的,以及如何修复它。”
|
||||
|
||||
### 创建更小的 WebP 图片
|
||||
|
||||
我测试的页面返回了三张图片。在它生成的报告中,它提供了推荐和目标。我选择了它报告有 650 KB 的 `app-graphic` 图片。通过把它转换为 WebP 格式,预计可以把图片大小降到 61 KB,节省 589 KB。我在 Photoshop 中把它转换了,用默认的 WebP 设置参数保存它,它的文件大小为 44.9 KB。比预期的还要好!从下面的 Photoshop 截图中可以看出,两张图在视觉质量上完全一样。
|
||||
|
||||
![WebP vs JPG comparison][4]
|
||||
|
||||
*左图:650 KB(实际大小)。右图: 44.9 KB(转换之后的目标大小)。*
|
||||
|
||||
当然,也可以用开源图片编辑工具 [GIMP][5] 把图片导出为 WebP。它提供了几个质量和压缩的参数:
|
||||
|
||||
![GIMP dialog for exporting webp, as a webp][6]
|
||||
|
||||
另一张图放大后:
|
||||
|
||||
![WebP vs PNG comparison][7]
|
||||
|
||||
PNG(左图)和 WebP(右图),都是从 JPG 转换而来,两图对比可以看出 WebP 不仅在文件大小更小,在视觉质量上也更优秀。
|
||||
|
||||
### 把图片转换为 WebP
|
||||
|
||||
你也可以用 Linux 的命令行工具把图片从 JPG/PNG 转换为 WebP:
|
||||
|
||||
在命令行使用 `cwebp` 把 PNG 或 JPG 图片文件转换为 WebP 格式。你可以用下面的命令把 PNG 图片文件转换为质量参数为 80 的 WebP 图片。
|
||||
|
||||
```
|
||||
cwebp -q 80 image.png -o image.webp
|
||||
```
|
||||
|
||||
你还可以用 [Image Magick][8],这个工具可能在你的发行版本软件仓库中可以找到。转换的子命令是 `convert`,它需要的所有参数就是输入和输出文件:
|
||||
|
||||
```
|
||||
convert pixel.png pixel.webp
|
||||
```
|
||||
|
||||
### 使用编辑器把图片转换为 WebP
|
||||
|
||||
要在图片编辑器中来把图片转换为 WebP,可以使用 [GIMP][9]。从 2.10 版本开始,它原生地支持 WebP。
|
||||
|
||||
如果你是 Photoshop 用户,由于 Photoshop 默认不包含 WebP 支持,因此你需要一个转换插件。遵循 Apache License 2.0 许可证发布的 WebPShop 0.2.1 是一个用于打开和保存包括动画图在内的 WebP 图片的 Photoshop 模块,在 <https://github.com/webmproject/WebPShop> 可以找到。
|
||||
|
||||
为了能正常使用它,你需要把它放进 Photoshop 插件目录下的 `bin` 文件夹:
|
||||
|
||||
Windows x64 :`C:\Program Files\Adobe\Adobe Photoshop\Plug-ins\WebPShop.8bi`
|
||||
|
||||
Mac:`Applications/Adobe Photoshop/Plug-ins/WebPShop.plugin`
|
||||
|
||||
### Wordpress 上的 WebP
|
||||
|
||||
很多网站是用 Wordpress 搭建的(我的网站就是)。因此,Wordpress 怎么上传 WebP 图片?本文撰写时,它还不支持。但是,当然已经有插件来满足这种需求,因此你可以在你的网站上同时准备 WebP 和 PNG/JPG 图片(为 Apple 用户)。
|
||||
|
||||
在 [Marius Hosting][11] 有下面的[说明][10]:
|
||||
|
||||
“直接向 Wordpress 上传 WebP 图片会怎样?这很简单。向你的主题 `functions.php` 文件添加几行内容就可以了。Wordpress 默认不支持展示和上传 WebP 文件,但是我会向你介绍一下怎么通过几个简单的步骤来让它支持。登录进你的 Wordpress 管理员界面,进入‘外观/主题编辑器’找到 `functions.php`。复制下面的代码粘贴到该文件最后并保存:
|
||||
|
||||
```
|
||||
//** *Enable upload for webp image files.*/
|
||||
function webp_upload_mimes($existing_mimes) {
|
||||
$existing_mimes['webp'] = 'image/webp';
|
||||
return $existing_mimes;
|
||||
}
|
||||
add_filter('mime_types', 'webp_upload_mimes');
|
||||
```
|
||||
|
||||
如果你想在‘媒体/媒体库’时看到缩略图预览,那么你需要把下面的代码也添加到 `functions.php` 文件。为了找到 `functions.php` 文件,进入‘外观/主题编辑器’并搜索 `functions.php`,然后复制下面的代码粘贴到文件最后并保存:
|
||||
|
||||
```
|
||||
//** * Enable preview / thumbnail for webp image files.*/
|
||||
function webp_is_displayable($result, $path) {
|
||||
if ($result === false) {
|
||||
$displayable_image_types = array( IMAGETYPE_WEBP );
|
||||
$info = @getimagesize( $path );
|
||||
|
||||
if (empty($info)) {
|
||||
$result = false;
|
||||
} elseif (!in_array($info[2], $displayable_image_types)) {
|
||||
$result = false;
|
||||
} else {
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2);
|
||||
```
|
||||
|
||||
”
|
||||
|
||||
### WebP 和未来
|
||||
|
||||
WebP 是一个健壮而优化的格式。它看起来更好,压缩率更高,并具有其他大部分常见图片格式的所有特性。不必再等了,现在就使用它吧。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/4/webp-image-compression
|
||||
|
||||
作者:[Jeff Macharyas][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[lxbwolf](https://github.com/lxbwolf)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jeffmacharyas
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/painting_computer_screen_art_design_creative.png?itok=LVAeQx3_ (Painting art on a computer screen)
|
||||
[2]: https://opensource.com/article/19/8/dig-binary-files-hexdump
|
||||
[3]: https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html
|
||||
[4]: https://opensource.com/sites/default/files/uploads/webp-vs-jpg-app-graphic.png (WebP vs JPG comparison)
|
||||
[5]: http://gimp.org
|
||||
[6]: https://img.linux.net.cn/data/attachment/album/202005/07/143538plu797s4wmhy9b1p.jpg (GIMP dialog for exporting webp, as a webp)
|
||||
[7]: https://opensource.com/sites/default/files/uploads/xcompare-png-left-webp-right.png (WebP vs PNG comparison)
|
||||
[8]: https://imagemagick.org
|
||||
[9]: https://en.wikipedia.org/wiki/GIMP
|
||||
[10]: https://mariushosting.com/how-to-upload-webp-files-on-wordpress/
|
||||
[11]: https://mariushosting.com/
|
@ -0,0 +1,116 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Good News! You Can Now Buy the De-Googled /e/OS Smartphone from Fairphone)
|
||||
[#]: via: (https://itsfoss.com/fairphone-with-e-os/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
Good News! You Can Now Buy the De-Googled /e/OS Smartphone from Fairphone
|
||||
======
|
||||
|
||||
Fairphone is known for its ethical (or fair) approach of making a smartphone.
|
||||
|
||||
Normally, the ethical approach involves that the workers get paid well, the smartphone build materials are safer for the planet, and the phone is durable/sustainable. And, they’ve already done a good job with their [Fairphone 1][1] , [Fairphone 2][2], and [Fairphone 3][3] smartphones.
|
||||
|
||||
Now, to take things up a notch, Fairphone has teamed up with [/e/OS][4] which is a de-googled Android fork, to launch a separate edition of [Fairphone 3][3] (its latest smartphone) that comes with **/e/OS** out of the box.
|
||||
|
||||
In case you didn’t know about the mobile operating system, you can read our [interview with Gael Duval (Founder of /e/OS)][5] to know more about it.
|
||||
|
||||
While we already have some privacy-focused smartphones like [Librem 5][6], Fairphone 3 with /e/OS is something different to its core. In this article, I’ll try highlighting the key things that you need to know before ordering a Fairphone 3 with /e/OS loaded.
|
||||
|
||||
### The First Privacy Conscious & Sustainable Phone
|
||||
|
||||
You may have noticed a privacy-focused smartphone manufactured in some corner of the world, like [Librem 5][7].
|
||||
|
||||
But for the most part, it looks like the Fairphone 3 is the first privacy-conscious sustainable phone to get the spotlight.
|
||||
|
||||
![][8]
|
||||
|
||||
The de-googled operating system /e/OS ensures that the smartphone does not rely on Google services to function among other things. Hence, /e/OS should be a great choice for Fairphone 3 for privacy-focused users.
|
||||
|
||||
Also, to support /e/OS out of the box wasn’t just the decision of the manufacturer – but its community.
|
||||
|
||||
As per their announcement, they’ve mentioned:
|
||||
|
||||
> For many, fairer technology isn’t just about the device and its components, it is also about the software that powers the product; and when Fairphone community members were asked what their preferred alternative operating system (OS) was for the next Fairphone, the Fairphone 3, they voted for /e/OS.
|
||||
|
||||
So, it looks like the users do prefer to have /e/OS on their smartphones.
|
||||
|
||||
### Fairphone 3: Overview
|
||||
|
||||
![][9]
|
||||
|
||||
To tell you what I think about it, let me first share the technical specifications of the phone:
|
||||
|
||||
* Dual Nano-SIM (4G LTE/3G/2G support)
|
||||
* **Display:** 5.65-inch LCD (IPS) with Corning Gorilla Glass 5 protection
|
||||
* **Screen Resolution**: 2160 x 1080
|
||||
* **RAM:** 4 GB
|
||||
* **Chipset**: Qualcomm Snapdragon 632
|
||||
* **Internal Storage:** 64 GB
|
||||
* **Rear Camera:** 12 MP (IMX363 sensor)
|
||||
* **Front Camera:** 8 MP
|
||||
* Bluetooth 5.0
|
||||
* WiFi 802.11a/b/g/n/ac
|
||||
* NFC Supported
|
||||
* USB-C
|
||||
* Expandable Storage supported
|
||||
|
||||
|
||||
|
||||
So, on paper, it sounds like a decent budget smartphone. But, the pricing and availability will be an important factor keeping in mind that it’s a one-of-a-kind smartphone and we don’t really have alternatives to compare to.
|
||||
|
||||
Not just how it’s unique for privacy-focused users, but it is potentially the easiest phone to fix (as suggested by [iFixit’s teardown][10]).
|
||||
|
||||
### Fairphone 3 with /e/OS: Pre-Order, Price & Availability
|
||||
|
||||
![][11]
|
||||
|
||||
As for its availability – the Fairphone 3 with /e/OS is available to pre-order through the [online shop of /e/OS][12] for **€479.90** across Europe.
|
||||
|
||||
If you are an existing Fairphone 3 user, you can also install /e/OS from the [available build here][13].
|
||||
|
||||
You get 2 years of warranty along with a 14-day return policy.
|
||||
|
||||
[Pre-Order Fairphone 3 With /e/OS][12]
|
||||
|
||||
### My Thoughts On Fairphone 3 with /e/OS
|
||||
|
||||
It’s important to consider that the smartphone is targeting a particular group of consumers. So, it’s quite obvious that it isn’t meant for everyone. The specifications on paper may look good – but not necessarily the best bang for the buck.
|
||||
|
||||
Also, looking at the smartphone market right now – the specifications and its value for money matter more than what we privacy-focused users want.
|
||||
|
||||
But it’s definitely something impressive and I believe it’s going to get good attention specially among the privacy-aware people who don’t want their smartphone spying on them.
|
||||
|
||||
With Fairphone 3’s launch with /e/OS, the lesser tech savvy people can now get an out of the box privacy-focused smartphone experience.
|
||||
|
||||
What do you think about the Fairphone 3 with /e/OS? Let me know your thoughts in the comments below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/fairphone-with-e-os/
|
||||
|
||||
作者:[Ankush Das][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://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://en.wikipedia.org/wiki/Fairphone_1
|
||||
[2]: https://en.wikipedia.org/wiki/Fairphone_2
|
||||
[3]: https://shop.fairphone.com/en/?ref=header
|
||||
[4]: https://e.foundation/
|
||||
[5]: https://itsfoss.com/gael-duval-interview/
|
||||
[6]: https://itsfoss.com/librem-5-available/
|
||||
[7]: https://itsfoss.com/librem-linux-phone/
|
||||
[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/Fairphone-3-battery.png?ssl=1
|
||||
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/fairphone-3.png?ssl=1
|
||||
[10]: https://www.ifixit.com/Teardown/Fairphone+3+Teardown/125573
|
||||
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/fairphone-e-os.png?ssl=1
|
||||
[12]: https://e.foundation/product/e-os-fairphone-3/
|
||||
[13]: https://doc.e.foundation/devices/FP3/
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (CrazyShipOne)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -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
|
@ -4,20 +4,20 @@
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Customizing my open source PHP framework for web development)
|
||||
[#]: via: (https://opensource.com/article/20/5/codeignitor)
|
||||
[#]: via: (https://opensource.com/article/20/5/codeigniter)
|
||||
[#]: author: (Wee Ben Sen https://opensource.com/users/bswee14)
|
||||
|
||||
Customizing my open source PHP framework for web development
|
||||
======
|
||||
Codeignitor is a PHP framework that empowers companies to develop
|
||||
Codeigniter is a PHP framework that empowers companies to develop
|
||||
high-performance websites with flexibility and ease.
|
||||
![Business woman on laptop sitting in front of window][1]
|
||||
|
||||
PHP Codeignitor is an open source framework providing business applications with the easy-to-use PHP programming language and powerful tools for coding. It also provides business intelligence, server monitoring, development, and application integration facilities. It's a relatively quiet project that you don't hear much about, but it's got a lot going for it that many developers new to it find surprising and refreshing.
|
||||
PHP Codeigniter is an open source framework providing business applications with the easy-to-use PHP programming language and powerful tools for coding. It also provides business intelligence, server monitoring, development, and application integration facilities. It's a relatively quiet project that you don't hear much about, but it's got a lot going for it that many developers new to it find surprising and refreshing.
|
||||
|
||||
I use [Codeignitor][2] at my job working for an online tuition service provider in Singapore. We offer services that aren't common enough to be the default feature set for templates or existing back-ends, so I need something that provides good, solid, raw materials I can build upon. Initially, I was considering other platforms such as Wordpress for our website; however, I arrived at Codeignitor due to its flexibility and integration of functions needed in the tuition-matching process.
|
||||
I use [Codeigniter][2] at my job working for an online tuition service provider in Singapore. We offer services that aren't common enough to be the default feature set for templates or existing back-ends, so I need something that provides good, solid, raw materials I can build upon. Initially, I was considering other platforms such as Wordpress for our website; however, I arrived at Codeigniter due to its flexibility and integration of functions needed in the tuition-matching process.
|
||||
|
||||
Here are the points that sold me on Codeignitor:
|
||||
Here are the points that sold me on Codeigniter:
|
||||
|
||||
* Database integration with MySQL—A major functionality is allowing clients to browse the tutor database and add tutors like a "shopping cart" similar to an e-commerce platform.
|
||||
* Client interface system—Users can log in to manage preferences and edit their particulars, modify subject taught, areas traveled, mobile number, address, etc.
|
||||
@ -31,16 +31,16 @@ The project took around six months to complete and another two months of debuggi
|
||||
|
||||
### Features and benefits
|
||||
|
||||
There are many more features that draw developers to PHP Codeignitor, including error handling and code formatting, which are useful in every coding situation. It supports templates, which can be used to add functionality to an existing website or to generate new ones. There are many features available for a business that needs to use a web-based system, including the ability to use custom tags. Most can be used by even an average developer who does not have any prior experience in programming.
|
||||
There are many more features that draw developers to PHP Codeigniter, including error handling and code formatting, which are useful in every coding situation. It supports templates, which can be used to add functionality to an existing website or to generate new ones. There are many features available for a business that needs to use a web-based system, including the ability to use custom tags. Most can be used by even an average developer who does not have any prior experience in programming.
|
||||
|
||||
The key features of Codeignitor are:
|
||||
The key features of Codeigniter are:
|
||||
|
||||
* XML core services,
|
||||
* HTTP/FTP core services
|
||||
* AppData and PHP sandbox features
|
||||
* XSLT and HTML templates
|
||||
* Encrypted information transfer
|
||||
* PCM Codeignitor server monitoring
|
||||
* PCM Codeigniter server monitoring
|
||||
* Application integration
|
||||
* File Transfer Protocol (FTP)
|
||||
* Help desk support
|
||||
@ -50,23 +50,23 @@ The key features of Codeignitor are:
|
||||
|
||||
#### Compatibility
|
||||
|
||||
Codeignitor is compatible with many leading software applications like PHP, MySQL, [MariaDB][3], [phpMyAdmin][4], [Apache][5], OpenBSD, XSLT, [SQLite][6], and more. A number of companies prefer to use Codeignitor products for their website requirements because they are easy to work with and integrate. If you're not comfortable creating your own website, you can find many developers and design agencies that provide custom web development services.
|
||||
Codeigniter is compatible with many leading software applications like PHP, MySQL, [MariaDB][3], [phpMyAdmin][4], [Apache][5], OpenBSD, XSLT, [SQLite][6], and more. A number of companies prefer to use Codeigniter products for their website requirements because they are easy to work with and integrate. If you're not comfortable creating your own website, you can find many developers and design agencies that provide custom web development services.
|
||||
|
||||
#### Security
|
||||
|
||||
Codeignitor also provides data security through SSL encryption. The encryption protects the data from external threats such as intruders and firewalls. The data storage facility also allows for security audits of the company's website.
|
||||
Codeigniter also provides data security through SSL encryption. The encryption protects the data from external threats such as intruders and firewalls. The data storage facility also allows for security audits of the company's website.
|
||||
|
||||
#### Other features
|
||||
|
||||
A good PHP web development company uses several advanced and third-party technologies such as XML and PHP. It provides organizations with a complete platform to develop professional-looking, useful websites with a business application. Codeignitor makes it easy to use third party technology, and works with common web development software. This allows web agencies to easily create websites with their chosen modules. Most PHP developers offer support and training services for individuals, as well.
|
||||
A good PHP web development company uses several advanced and third-party technologies such as XML and PHP. It provides organizations with a complete platform to develop professional-looking, useful websites with a business application. Codeigniter makes it easy to use third party technology, and works with common web development software. This allows web agencies to easily create websites with their chosen modules. Most PHP developers offer support and training services for individuals, as well.
|
||||
|
||||
### Using PHP framework Codeignitor
|
||||
### Using PHP framework Codeigniter
|
||||
|
||||
Codeignitor allows businesses to have a complete package for PHP development that will offer the right combination of power, flexibility, and performance. So far, I am very pleased with our website and I have continuously upgraded and added new features along the way. I look forward to discovering what else I can do with our website using Codeignitor. Could it be right for you too?
|
||||
Codeigniter allows businesses to have a complete package for PHP development that will offer the right combination of power, flexibility, and performance. So far, I am very pleased with our website and I have continuously upgraded and added new features along the way. I look forward to discovering what else I can do with our website using Codeigniter. Could it be right for you too?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/5/codeignitor
|
||||
via: https://opensource.com/article/20/5/codeigniter
|
||||
|
||||
作者:[Wee Ben Sen][a]
|
||||
选题:[lujun9972][b]
|
||||
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -0,0 +1,618 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Using the systemctl command to manage systemd units)
|
||||
[#]: via: (https://opensource.com/article/20/5/systemd-units)
|
||||
[#]: author: (David Both https://opensource.com/users/dboth)
|
||||
|
||||
Using the systemctl command to manage systemd units
|
||||
======
|
||||
Units are the basis of everything in systemd.
|
||||
![woman on laptop sitting at the window][1]
|
||||
|
||||
In the first two articles in this series, I explored the Linux systemd startup sequence. In the [first article][2], I looked at systemd's functions and architecture and the controversy around its role as a replacement for the old SystemV init program and startup scripts. And in the [second article][3], I examined two important systemd tools, systemctl and journalctl, and explained how to switch from one target to another and to change the default target.
|
||||
|
||||
In this third article, I'll look at systemd units in more detail and how to use the systemctl command to explore and manage units. I'll also explain how to stop and disable units and how to create a new systemd mount unit to mount a new filesystem and enable it to initiate during startup.
|
||||
|
||||
### Preparation
|
||||
|
||||
All of the experiments in this article should be done as the root user (unless otherwise specified). Some of the commands that simply list various systemd units can be performed by non-root users, but the commands that make changes cannot. Make sure to do all of these experiments only on non-production hosts or virtual machines (VMs).
|
||||
|
||||
One of these experiments requires the sysstat package, so install it before you move on. For Fedora and other Red Hat-based distributions you can install sysstat with:
|
||||
|
||||
|
||||
```
|
||||
`dnf -y install sysstat`
|
||||
```
|
||||
|
||||
The sysstat RPM installs several statistical tools that can be used for problem determination. One is [System Activity Report][4] (SAR), which records many system performance data points at regular intervals (every 10 minutes by default). Rather than run as a daemon in the background, the sysstat package installs two systemd timers. One timer runs every 10 minutes to collect data, and the other runs once a day to aggregate the daily data. In this article, I will look briefly at these timers but wait to explain how to create a timer in a future article.
|
||||
|
||||
### systemd suite
|
||||
|
||||
The fact is, systemd is more than just one program. It is a large suite of programs all designed to work together to manage nearly every aspect of a running Linux system. A full exposition of systemd would take a book on its own. Most of us do not need to understand all of the details about how all of systemd's components fit together, so I will focus on the programs and components that enable you to manage various Linux services and deal with log files and journals.
|
||||
|
||||
### Practical structure
|
||||
|
||||
The structure of systemd—outside of its executable files—is contained in its many configuration files. Although these files have different names and identifier extensions, they are all called "unit" files. Units are the basis of everything systemd.
|
||||
|
||||
Unit files are ASCII plain-text files that are accessible to and can be created or modified by a sysadmin. There are a number of unit file types, and each has its own man page. Figure 1 lists some of these unit file types by their filename extensions and a short description of each.
|
||||
|
||||
systemd unit | Description
|
||||
---|---
|
||||
.automount | The **.automount** units are used to implement on-demand (i.e., plug and play) and mounting of filesystem units in parallel during startup.
|
||||
.device | The **.device** unit files define hardware and virtual devices that are exposed to the sysadmin in the **/dev/directory**. Not all devices have unit files; typically, block devices such as hard drives, network devices, and some others have unit files.
|
||||
.mount | The **.mount** unit defines a mount point on the Linux filesystem directory structure.
|
||||
.scope | The **.scope** unit defines and manages a set of system processes. This unit is not configured using unit files, rather it is created programmatically. Per the **systemd.scope** man page, “The main purpose of scope units is grouping worker processes of a system service for organization and for managing resources.”
|
||||
.service | The **.service** unit files define processes that are managed by systemd. These include services such as crond cups (Common Unix Printing System), iptables, multiple logical volume management (LVM) services, NetworkManager, and more.
|
||||
.slice | The **.slice** unit defines a “slice,” which is a conceptual division of system resources that are related to a group of processes. You can think of all system resources as a pie and this subset of resources as a “slice” out of that pie.
|
||||
.socket | The **.socket** units define interprocess communication sockets, such as network sockets.
|
||||
.swap | The **.swap** units define swap devices or files.
|
||||
.target | The **.target** units define groups of unit files that define startup synchronization points, runlevels, and services. Target units define the services and other units that must be active in order to start successfully.
|
||||
.timer | The **.timer** unit defines timers that can initiate program execution at specified times.
|
||||
|
||||
### systemctl
|
||||
|
||||
I looked at systemd's startup functions in the [second article][3], and here I'll explore its service management functions a bit further. systemd provides the **systemctl** command that is used to start and stop services, configure them to launch (or not) at system startup, and monitor the current status of running services.
|
||||
|
||||
In a terminal session as the root user, ensure that root's home directory ( **~** ) is the [PWD][5]. To begin looking at units in various ways, list all of the loaded and active systemd units. systemctl automatically pipes its [stdout][6] data stream through the **less** pager, so you don't have to:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# systemctl
|
||||
UNIT LOAD ACTIVE SUB DESCRIPTION
|
||||
proc-sys-fs-binfmt_misc.automount loaded active running Arbitrary Executable File>
|
||||
sys-devices-pci0000:00-0000:00:01.1-ata7-host6-target6:0:0-6:0:0:0-block-sr0.device loaded a>
|
||||
sys-devices-pci0000:00-0000:00:03.0-net-enp0s3.device loaded active plugged 82540EM Gigabi>
|
||||
sys-devices-pci0000:00-0000:00:05.0-sound-card0.device loaded active plugged 82801AA AC'97>
|
||||
sys-devices-pci0000:00-0000:00:08.0-net-enp0s8.device loaded active plugged 82540EM Gigabi>
|
||||
sys-devices-pci0000:00-0000:00:0d.0-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda1.device loa>
|
||||
sys-devices-pci0000:00-0000:00:0d.0-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda2.device loa>
|
||||
<snip – removed lots of lines of data from here>
|
||||
|
||||
LOAD = Reflects whether the unit definition was properly loaded.
|
||||
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
|
||||
SUB = The low-level unit activation state, values depend on unit type.
|
||||
|
||||
206 loaded units listed. Pass --all to see loaded but inactive units, too.
|
||||
To show all installed unit files use 'systemctl list-unit-files'.
|
||||
```
|
||||
|
||||
As you scroll through the data in your terminal session, look for some specific things. The first section lists devices such as hard drives, sound cards, network interface cards, and TTY devices. Another section shows the filesystem mount points. Other sections include various services and a list of all loaded and active targets.
|
||||
|
||||
The sysstat timers at the bottom of the output are used to collect and generate daily system activity summaries for SAR. SAR is a very useful problem-solving tool. (You can learn more about it in Chapter 13 of my book [_Using and Administering Linux: Volume 1, Zero to SysAdmin: Getting Started_][7].)
|
||||
|
||||
Near the very bottom, three lines describe the meanings of the statuses (loaded, active, and sub). Press **q** to exit the pager.
|
||||
|
||||
Use the following command (as suggested in the last line of the output above) to see all the units that are installed, whether or not they are loaded. I won't reproduce the output here, because you can scroll through it on your own. The systemctl program has an excellent tab-completion facility that makes it easy to enter complex commands without needing to memorize all the options:
|
||||
|
||||
|
||||
```
|
||||
`[root@testvm1 ~]# systemctl list-unit-files`
|
||||
```
|
||||
|
||||
You can see that some units are disabled. Table 1 in the man page for systemctl lists and provides short descriptions of the entries you might see in this listing. Use the **-t** (type) option to view just the timer units:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# systemctl list-unit-files -t timer
|
||||
UNIT FILE STATE
|
||||
[chrony-dnssrv@.timer][8] disabled
|
||||
dnf-makecache.timer enabled
|
||||
fstrim.timer disabled
|
||||
logrotate.timer disabled
|
||||
logwatch.timer disabled
|
||||
[mdadm-last-resort@.timer][9] static
|
||||
mlocate-updatedb.timer enabled
|
||||
sysstat-collect.timer enabled
|
||||
sysstat-summary.timer enabled
|
||||
systemd-tmpfiles-clean.timer static
|
||||
unbound-anchor.timer enabled
|
||||
```
|
||||
|
||||
You could do the same thing with this alternative, which provides considerably more detail:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# systemctl list-timers
|
||||
Thu 2020-04-16 09:06:20 EDT 3min 59s left n/a n/a systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
|
||||
Thu 2020-04-16 10:02:01 EDT 59min left Thu 2020-04-16 09:01:32 EDT 49s ago dnf-makecache.timer dnf-makecache.service
|
||||
Thu 2020-04-16 13:00:00 EDT 3h 57min left n/a n/a sysstat-collect.timer sysstat-collect.service
|
||||
Fri 2020-04-17 00:00:00 EDT 14h left Thu 2020-04-16 12:51:37 EDT 3h 49min left mlocate-updatedb.timer mlocate-updatedb.service
|
||||
Fri 2020-04-17 00:00:00 EDT 14h left Thu 2020-04-16 12:51:37 EDT 3h 49min left unbound-anchor.timer unbound-anchor.service
|
||||
Fri 2020-04-17 00:07:00 EDT 15h left n/a n/a sysstat-summary.timer sysstat-summary.service
|
||||
|
||||
6 timers listed.
|
||||
Pass --all to see loaded but inactive timers, too.
|
||||
[root@testvm1 ~]#
|
||||
```
|
||||
|
||||
Although there is no option to do systemctl list-mounts, you can list the mount point unit files:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# systemctl list-unit-files -t mount
|
||||
UNIT FILE STATE
|
||||
-.mount generated
|
||||
boot.mount generated
|
||||
dev-hugepages.mount static
|
||||
dev-mqueue.mount static
|
||||
home.mount generated
|
||||
proc-fs-nfsd.mount static
|
||||
proc-sys-fs-binfmt_misc.mount disabled
|
||||
run-vmblock\x2dfuse.mount disabled
|
||||
sys-fs-fuse-connections.mount static
|
||||
sys-kernel-config.mount static
|
||||
sys-kernel-debug.mount static
|
||||
tmp.mount generated
|
||||
usr.mount generated
|
||||
var-lib-nfs-rpc_pipefs.mount static
|
||||
var.mount generated
|
||||
|
||||
15 unit files listed.
|
||||
[root@testvm1 ~]#
|
||||
```
|
||||
|
||||
The STATE column in this data stream is interesting and requires a bit of explanation. The "generated" states indicate that the mount unit was generated on the fly during startup using the information in **/etc/fstab**. The program that generates these mount units is **/lib/systemd/system-generators/systemd-fstab-generator,** along with other tools that generate a number of other unit types. The "static" mount units are for filesystems like **/proc** and **/sys**, and the files for these are located in the **/usr/lib/systemd/system** directory.
|
||||
|
||||
Now, look at the service units. This command will show all services installed on the host, whether or not they are active:
|
||||
|
||||
|
||||
```
|
||||
`[root@testvm1 ~]# systemctl --all -t service`
|
||||
```
|
||||
|
||||
The bottom of this listing of service units displays 166 as the total number of loaded units on my host. Your number will probably differ.
|
||||
|
||||
Unit files do not have a filename extension (such as **.unit**) to help identify them, so you can generalize that most configuration files that belong to systemd are unit files of one type or another. The few remaining files are mostly **.conf** files located in **/etc/systemd**.
|
||||
|
||||
Unit files are stored in the **/usr/lib/systemd** directory and its subdirectories, while the **/etc/systemd/** directory and its subdirectories contain symbolic links to the unit files necessary to the local configuration of this host.
|
||||
|
||||
To explore this, make **/etc/systemd** the PWD and list its contents. Then make **/etc/systemd/system** the PWD and list its contents, and list the contents of at least a couple of the current PWD's subdirectories.
|
||||
|
||||
Take a look at the **default.target** file, which determines which runlevel target the system will boot to. In the second article in this series, I explained how to change the default target from the GUI (**graphical.target**) to the command-line only (**multi-user.target**) target. The **default.target** file on my test VM is simply a symlink to **/usr/lib/systemd/system/graphical.target**.
|
||||
|
||||
Take a few minutes to examine the contents of the **/etc/systemd/system/default.target** file:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 system]# cat default.target
|
||||
# SPDX-License-Identifier: LGPL-2.1+
|
||||
#
|
||||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
[Unit]
|
||||
Description=Graphical Interface
|
||||
Documentation=man:systemd.special(7)
|
||||
Requires=multi-user.target
|
||||
Wants=display-manager.service
|
||||
Conflicts=rescue.service rescue.target
|
||||
After=multi-user.target rescue.service rescue.target display-manager.service
|
||||
AllowIsolate=yes
|
||||
```
|
||||
|
||||
Note that this requires the **multi-user.target**; the **graphical.target** cannot start if the **multi-user.target** is not already up and running. It also says it "wants" the **display-manager.service** unit. A "want" does not need to be fulfilled in order for the unit to start successfully. If the "want" cannot be fulfilled, it will be ignored by systemd, and the rest of the target will start regardless.
|
||||
|
||||
The subdirectories in **/etc/systemd/system** are lists of wants for various targets. Take a few minutes to explore the files and their contents in the **/etc/systemd/system/graphical.target.wants** directory.
|
||||
|
||||
The **systemd.unit** man page contains a lot of good information about unit files, their structure, the sections they can be divided into, and the options that can be used. It also lists many of the unit types, all of which have their own man pages. If you want to interpret a unit file, this would be a good place to start.
|
||||
|
||||
### Service units
|
||||
|
||||
A Fedora installation usually installs and enables services that particular hosts do not need for normal operation. Conversely, sometimes it doesn't include services that need to be installed, enabled, and started. Services that are not needed for the Linux host to function as desired, but which are installed and possibly running, represent a security risk and should—at minimum—be stopped and disabled and—at best—should be uninstalled.
|
||||
|
||||
The systemctl command is used to manage systemd units, including services, targets, mounts, and more. Take a closer look at the list of services to identify services that will never be used:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# systemctl --all -t service
|
||||
UNIT LOAD ACTIVE SUB DESCRIPTION
|
||||
<snip>
|
||||
chronyd.service loaded active running NTP client/server
|
||||
crond.service loaded active running Command Scheduler
|
||||
cups.service loaded active running CUPS Scheduler
|
||||
dbus-daemon.service loaded active running D-Bus System Message Bus
|
||||
<snip>
|
||||
● ip6tables.service not-found inactive dead ip6tables.service
|
||||
● ipset.service not-found inactive dead ipset.service
|
||||
● iptables.service not-found inactive dead iptables.service
|
||||
<snip>
|
||||
firewalld.service loaded active running firewalld - dynamic firewall daemon
|
||||
<snip>
|
||||
● ntpd.service not-found inactive dead ntpd.service
|
||||
● ntpdate.service not-found inactive dead ntpdate.service
|
||||
pcscd.service loaded active running PC/SC Smart Card Daemon
|
||||
```
|
||||
|
||||
I have pruned out most of the output from the command to save space. The services that show "loaded active running" are obvious. The "not-found" services are ones that systemd is aware of but are not installed on the Linux host. If you want to run those services, you must install the packages that contain them.
|
||||
|
||||
Note the **pcscd.service** unit. This is the PC/SC smart-card daemon. Its function is to communicate with smart-card readers. Many Linux hosts—including VMs—have no need for this reader nor the service that is loaded and taking up memory and CPU resources. You can stop this service and disable it, so it will not restart on the next boot. First, check its status:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# systemctl status pcscd.service
|
||||
● pcscd.service - PC/SC Smart Card Daemon
|
||||
Loaded: loaded (/usr/lib/systemd/system/pcscd.service; indirect; vendor preset: disabled)
|
||||
Active: active (running) since Fri 2019-05-10 11:28:42 EDT; 3 days ago
|
||||
Docs: man:pcscd(8)
|
||||
Main PID: 24706 (pcscd)
|
||||
Tasks: 6 (limit: 4694)
|
||||
Memory: 1.6M
|
||||
CGroup: /system.slice/pcscd.service
|
||||
└─24706 /usr/sbin/pcscd --foreground --auto-exit
|
||||
|
||||
May 10 11:28:42 testvm1 systemd[1]: Started PC/SC Smart Card Daemon.
|
||||
```
|
||||
|
||||
This data illustrates the additional information systemd provides versus SystemV, which only reports whether or not the service is running. Note that specifying the **.service** unit type is optional. Now stop and disable the service, then re-check its status:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# systemctl stop pcscd ; systemctl disable pcscd
|
||||
Warning: Stopping pcscd.service, but it can still be activated by:
|
||||
pcscd.socket
|
||||
Removed /etc/systemd/system/sockets.target.wants/pcscd.socket.
|
||||
[root@testvm1 ~]# systemctl status pcscd
|
||||
● pcscd.service - PC/SC Smart Card Daemon
|
||||
Loaded: loaded (/usr/lib/systemd/system/pcscd.service; indirect; vendor preset: disabled)
|
||||
Active: failed (Result: exit-code) since Mon 2019-05-13 15:23:15 EDT; 48s ago
|
||||
Docs: man:pcscd(8)
|
||||
Main PID: 24706 (code=exited, status=1/FAILURE)
|
||||
|
||||
May 10 11:28:42 testvm1 systemd[1]: Started PC/SC Smart Card Daemon.
|
||||
May 13 15:23:15 testvm1 systemd[1]: Stopping PC/SC Smart Card Daemon...
|
||||
May 13 15:23:15 testvm1 systemd[1]: pcscd.service: Main process exited, code=exited, status=1/FAIL>
|
||||
May 13 15:23:15 testvm1 systemd[1]: pcscd.service: Failed with result 'exit-code'.
|
||||
May 13 15:23:15 testvm1 systemd[1]: Stopped PC/SC Smart Card Daemon.
|
||||
```
|
||||
|
||||
The short log entry display for most services prevents having to search through various log files to locate this type of information. Check the status of the system runlevel targets—specifying the "target" unit type is required:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# systemctl status multi-user.target
|
||||
● multi-user.target - Multi-User System
|
||||
Loaded: loaded (/usr/lib/systemd/system/multi-user.target; static; vendor preset: disabled)
|
||||
Active: active since Thu 2019-05-09 13:27:22 EDT; 4 days ago
|
||||
Docs: man:systemd.special(7)
|
||||
|
||||
May 09 13:27:22 testvm1 systemd[1]: Reached target Multi-User System.
|
||||
[root@testvm1 ~]# systemctl status graphical.target
|
||||
● graphical.target - Graphical Interface
|
||||
Loaded: loaded (/usr/lib/systemd/system/graphical.target; indirect; vendor preset: disabled)
|
||||
Active: active since Thu 2019-05-09 13:27:22 EDT; 4 days ago
|
||||
Docs: man:systemd.special(7)
|
||||
|
||||
May 09 13:27:22 testvm1 systemd[1]: Reached target Graphical Interface.
|
||||
[root@testvm1 ~]# systemctl status default.target
|
||||
● graphical.target - Graphical Interface
|
||||
Loaded: loaded (/usr/lib/systemd/system/graphical.target; indirect; vendor preset: disabled)
|
||||
Active: active since Thu 2019-05-09 13:27:22 EDT; 4 days ago
|
||||
Docs: man:systemd.special(7)
|
||||
|
||||
May 09 13:27:22 testvm1 systemd[1]: Reached target Graphical Interface.
|
||||
```
|
||||
|
||||
The default target is the graphical target. The status of any unit can be checked in this way.
|
||||
|
||||
### Mounts the old way
|
||||
|
||||
A mount unit defines all of the parameters required to mount a filesystem on a designated mount point. systemd can manage mount units with more flexibility than those using the **/etc/fstab** filesystem configuration file. Despite this, systemd still uses the **/etc/fstab** file for filesystem configuration and mounting purposes. systemd uses the **systemd-fstab-generator** tool to create transient mount units from the data in the **fstab** file.
|
||||
|
||||
I will create a new filesystem and a systemd mount unit to mount it. If you have some available disk space on your test system, you can do it along with me.
|
||||
|
||||
_Note that the volume group and logical volume names may be different on your test system. Be sure to use the names that are pertinent to your system._
|
||||
|
||||
You will need to create a partition or logical volume, then make an EXT4 filesystem on it. Add a label to the filesystem, **TestFS**, and create a directory for a mount point **/TestFS**.
|
||||
|
||||
To try this on your own, first, verify that you have free space on the volume group. Here is what that looks like on my VM where I have some space available on the volume group to create a new logical volume:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
||||
sda 8:0 0 120G 0 disk
|
||||
├─sda1 8:1 0 4G 0 part /boot
|
||||
└─sda2 8:2 0 116G 0 part
|
||||
├─VG01-root 253:0 0 5G 0 lvm /
|
||||
├─VG01-swap 253:1 0 8G 0 lvm [SWAP]
|
||||
├─VG01-usr 253:2 0 30G 0 lvm /usr
|
||||
├─VG01-home 253:3 0 20G 0 lvm /home
|
||||
├─VG01-var 253:4 0 20G 0 lvm /var
|
||||
└─VG01-tmp 253:5 0 10G 0 lvm /tmp
|
||||
sr0 11:0 1 1024M 0 rom
|
||||
[root@testvm1 ~]# vgs
|
||||
VG #PV #LV #SN Attr VSize VFree
|
||||
VG01 1 6 0 wz--n- <116.00g <23.00g
|
||||
```
|
||||
|
||||
Then create a new volume on **VG01** named **TestFS**. It does not need to be large; 1GB is fine. Then create a filesystem, add the filesystem label, and create the mount point:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# lvcreate -L 1G -n TestFS VG01
|
||||
Logical volume "TestFS" created.
|
||||
[root@testvm1 ~]# mkfs -t ext4 /dev/mapper/VG01-TestFS
|
||||
mke2fs 1.45.3 (14-Jul-2019)
|
||||
Creating filesystem with 262144 4k blocks and 65536 inodes
|
||||
Filesystem UUID: 8718fba9-419f-4915-ab2d-8edf811b5d23
|
||||
Superblock backups stored on blocks:
|
||||
32768, 98304, 163840, 229376
|
||||
|
||||
Allocating group tables: done
|
||||
Writing inode tables: done
|
||||
Creating journal (8192 blocks): done
|
||||
Writing superblocks and filesystem accounting information: done
|
||||
|
||||
[root@testvm1 ~]# e2label /dev/mapper/VG01-TestFS TestFS
|
||||
[root@testvm1 ~]# mkdir /TestFS
|
||||
```
|
||||
|
||||
Now, mount the new filesystem:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# mount /TestFS/
|
||||
mount: /TestFS/: can't find in /etc/fstab.
|
||||
```
|
||||
|
||||
This will not work because you do not have an entry in **/etc/fstab**. You can mount the new filesystem even without the entry in **/etc/fstab** using both the device name (as it appears in **/dev**) and the mount point. Mounting in this manner is simpler than it used to be—it used to require the filesystem type as an argument. The mount command is now smart enough to detect the filesystem type and mount it accordingly.
|
||||
|
||||
Try it again:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# mount /dev/mapper/VG01-TestFS /TestFS/
|
||||
[root@testvm1 ~]# lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
||||
sda 8:0 0 120G 0 disk
|
||||
├─sda1 8:1 0 4G 0 part /boot
|
||||
└─sda2 8:2 0 116G 0 part
|
||||
├─VG01-root 253:0 0 5G 0 lvm /
|
||||
├─VG01-swap 253:1 0 8G 0 lvm [SWAP]
|
||||
├─VG01-usr 253:2 0 30G 0 lvm /usr
|
||||
├─VG01-home 253:3 0 20G 0 lvm /home
|
||||
├─VG01-var 253:4 0 20G 0 lvm /var
|
||||
├─VG01-tmp 253:5 0 10G 0 lvm /tmp
|
||||
└─VG01-TestFS 253:6 0 1G 0 lvm /TestFS
|
||||
sr0 11:0 1 1024M 0 rom
|
||||
[root@testvm1 ~]#
|
||||
```
|
||||
|
||||
Now the new filesystem is mounted in the proper location. List the mount unit files:
|
||||
|
||||
|
||||
```
|
||||
`[root@testvm1 ~]# systemctl list-unit-files -t mount`
|
||||
```
|
||||
|
||||
This command does not show a file for the **/TestFS** filesystem because no file exists for it. The command **systemctl status TestFS.mount** does not display any information about the new filesystem either. You can try it using wildcards with the **systemctl status** command:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# systemctl status *mount
|
||||
● usr.mount - /usr
|
||||
Loaded: loaded (/etc/fstab; generated)
|
||||
Active: active (mounted)
|
||||
Where: /usr
|
||||
What: /dev/mapper/VG01-usr
|
||||
Docs: man:fstab(5)
|
||||
man:systemd-fstab-generator(8)
|
||||
|
||||
<SNIP>
|
||||
● TestFS.mount - /TestFS
|
||||
Loaded: loaded (/proc/self/mountinfo)
|
||||
Active: active (mounted) since Fri 2020-04-17 16:02:26 EDT; 1min 18s ago
|
||||
Where: /TestFS
|
||||
What: /dev/mapper/VG01-TestFS
|
||||
|
||||
● run-user-0.mount - /run/user/0
|
||||
Loaded: loaded (/proc/self/mountinfo)
|
||||
Active: active (mounted) since Thu 2020-04-16 08:52:29 EDT; 1 day 5h ago
|
||||
Where: /run/user/0
|
||||
What: tmpfs
|
||||
|
||||
● var.mount - /var
|
||||
Loaded: loaded (/etc/fstab; generated)
|
||||
Active: active (mounted) since Thu 2020-04-16 12:51:34 EDT; 1 day 1h ago
|
||||
Where: /var
|
||||
What: /dev/mapper/VG01-var
|
||||
Docs: man:fstab(5)
|
||||
man:systemd-fstab-generator(8)
|
||||
Tasks: 0 (limit: 19166)
|
||||
Memory: 212.0K
|
||||
CPU: 5ms
|
||||
CGroup: /system.slice/var.mount
|
||||
```
|
||||
|
||||
This command provides some very interesting information about your system's mounts, and your new filesystem shows up. The **/var** and **/usr** filesystems are identified as being generated from **/etc/fstab**, while your new filesystem simply shows that it is loaded and provides the location of the info file in the **/proc/self/mountinfo** file.
|
||||
|
||||
Next, automate this mount. First, do it the old-fashioned way by adding an entry in **/etc/fstab**. Later, I'll show you how to do it the new way, which will teach you about creating units and integrating them into the startup sequence.
|
||||
|
||||
Unmount **/TestFS** and add the following line to the **/etc/fstab** file:
|
||||
|
||||
|
||||
```
|
||||
`/dev/mapper/VG01-TestFS /TestFS ext4 defaults 1 2`
|
||||
```
|
||||
|
||||
Now, mount the filesystem with the simpler **mount** command and list the mount units again:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# mount /TestFS
|
||||
[root@testvm1 ~]# systemctl status *mount
|
||||
<SNIP>
|
||||
● TestFS.mount - /TestFS
|
||||
Loaded: loaded (/proc/self/mountinfo)
|
||||
Active: active (mounted) since Fri 2020-04-17 16:26:44 EDT; 1min 14s ago
|
||||
Where: /TestFS
|
||||
What: /dev/mapper/VG01-TestFS
|
||||
<SNIP>
|
||||
```
|
||||
|
||||
This did not change the information for this mount because the filesystem was manually mounted. Reboot and run the command again, and this time specify **TestFS.mount** rather than using the wildcard. The results for this mount are now consistent with it being mounted at startup:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# systemctl status TestFS.mount
|
||||
● TestFS.mount - /TestFS
|
||||
Loaded: loaded (/etc/fstab; generated)
|
||||
Active: active (mounted) since Fri 2020-04-17 16:30:21 EDT; 1min 38s ago
|
||||
Where: /TestFS
|
||||
What: /dev/mapper/VG01-TestFS
|
||||
Docs: man:fstab(5)
|
||||
man:systemd-fstab-generator(8)
|
||||
Tasks: 0 (limit: 19166)
|
||||
Memory: 72.0K
|
||||
CPU: 6ms
|
||||
CGroup: /system.slice/TestFS.mount
|
||||
|
||||
Apr 17 16:30:21 testvm1 systemd[1]: Mounting /TestFS...
|
||||
Apr 17 16:30:21 testvm1 systemd[1]: Mounted /TestFS.
|
||||
```
|
||||
|
||||
### Creating a mount unit
|
||||
|
||||
Mount units may be configured either with the traditional **/etc/fstab** file or with systemd units. Fedora uses the **fstab** file as it is created during the installation. However, systemd uses the **systemd-fstab-generator** program to translate the **fstab** file into systemd units for each entry in the **fstab** file. Now that you know you can use systemd **.mount** unit files for filesystem mounting, try it out by creating a mount unit for this filesystem.
|
||||
|
||||
First, unmount **/TestFS**. Edit the **/etc/fstab** file and delete or comment out the **TestFS** line. Now, create a new file with the name **TestFS.mount** in the **/etc/systemd/system** directory. Edit it to contain the configuration data below. The unit file name and the name of the mount point _must_ be identical, or the mount will fail:
|
||||
|
||||
|
||||
```
|
||||
# This mount unit is for the TestFS filesystem
|
||||
# By David Both
|
||||
# Licensed under GPL V2
|
||||
# This file should be located in the /etc/systemd/system directory
|
||||
|
||||
[Unit]
|
||||
Description=TestFS Mount
|
||||
|
||||
[Mount]
|
||||
What=/dev/mapper/VG01-TestFS
|
||||
Where=/TestFS
|
||||
Type=ext4
|
||||
Options=defaults
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
The **Description** line in the **[Unit]** section is for us humans, and it provides the name that's shown when you list mount units with **systemctl -t mount**. The data in the **[Mount]** section of this file contains essentially the same data that would be found in the **fstab** file.
|
||||
|
||||
Now enable the mount unit:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 etc]# systemctl enable TestFS.mount
|
||||
Created symlink /etc/systemd/system/multi-user.target.wants/TestFS.mount → /etc/systemd/system/TestFS.mount.
|
||||
```
|
||||
|
||||
This creates the symlink in the **/etc/systemd/system** directory, which will cause this mount unit to be mounted on all subsequent boots. The filesystem has not yet been mounted, so you must "start" it:
|
||||
|
||||
|
||||
```
|
||||
`[root@testvm1 ~]# systemctl start TestFS.mount`
|
||||
```
|
||||
|
||||
Verify that the filesystem has been mounted:
|
||||
|
||||
|
||||
```
|
||||
[root@testvm1 ~]# systemctl status TestFS.mount
|
||||
● TestFS.mount - TestFS Mount
|
||||
Loaded: loaded (/etc/systemd/system/TestFS.mount; enabled; vendor preset: disabled)
|
||||
Active: active (mounted) since Sat 2020-04-18 09:59:53 EDT; 14s ago
|
||||
Where: /TestFS
|
||||
What: /dev/mapper/VG01-TestFS
|
||||
Tasks: 0 (limit: 19166)
|
||||
Memory: 76.0K
|
||||
CPU: 3ms
|
||||
CGroup: /system.slice/TestFS.mount
|
||||
|
||||
Apr 18 09:59:53 testvm1 systemd[1]: Mounting TestFS Mount...
|
||||
Apr 18 09:59:53 testvm1 systemd[1]: Mounted TestFS Mount.
|
||||
```
|
||||
|
||||
This experiment has been specifically about creating a unit file for a mount, but it can be applied to other types of unit files as well. The details will be different, but the concepts are the same. Yes, I know it is still easier to add a line to the **/etc/fstab** file than it is to create a mount unit. But this is a good example of how to create a unit file because systemd does not have generators for every type of unit.
|
||||
|
||||
### In summary
|
||||
|
||||
This article looked at systemd units in more detail and how to use the systemctl command to explore and manage units. It also showed how to stop and disable units and create a new systemd mount unit to mount a new filesystem and enable it to initiate during startup.
|
||||
|
||||
In the next article in this series, I will take you through a recent problem I had during startup and show you how I circumvented it using systemd.
|
||||
|
||||
### Resources
|
||||
|
||||
There is a great deal of information about systemd available on the internet, but much is terse, obtuse, or even misleading. In addition to the resources mentioned in this article, the following webpages offer more detailed and reliable information about systemd startup.
|
||||
|
||||
* The Fedora Project has a good, practical [guide][10] [to systemd][10]. It has pretty much everything you need to know in order to configure, manage, and maintain a Fedora computer using systemd.
|
||||
* The Fedora Project also has a good [cheat sheet][11] that cross-references the old SystemV commands to comparable systemd ones.
|
||||
* For detailed technical information about systemd and the reasons for creating it, check out [Freedesktop.org][12]'s [description of systemd][13].
|
||||
* [Linux.com][14]'s "More systemd fun" offers more advanced systemd [information and tips][15].
|
||||
|
||||
|
||||
|
||||
There is also a series of deeply technical articles for Linux sysadmins by Lennart Poettering, the designer and primary developer of systemd. These articles were written between April 2010 and September 2011, but they are just as relevant now as they were then. Much of everything else good that has been written about systemd and its ecosystem is based on these papers.
|
||||
|
||||
* [Rethinking PID 1][16]
|
||||
* [systemd for Administrators, Part I][17]
|
||||
* [systemd for Administrators, Part II][18]
|
||||
* [systemd for Administrators, Part III][19]
|
||||
* [systemd for Administrators, Part IV][20]
|
||||
* [systemd for Administrators, Part V][21]
|
||||
* [systemd for Administrators, Part VI][22]
|
||||
* [systemd for Administrators, Part VII][23]
|
||||
* [systemd for Administrators, Part VIII][24]
|
||||
* [systemd for Administrators, Part IX][25]
|
||||
* [systemd for Administrators, Part X][26]
|
||||
* [systemd for Administrators, Part XI][27]
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/5/systemd-units
|
||||
|
||||
作者:[David Both][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://opensource.com/users/dboth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop)
|
||||
[2]: https://opensource.com/article/20/4/systemd
|
||||
[3]: https://opensource.com/article/20/4/systemd-startup
|
||||
[4]: https://en.wikipedia.org/wiki/Sar_%28Unix%29
|
||||
[5]: https://en.wikipedia.org/wiki/Pwd
|
||||
[6]: https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)
|
||||
[7]: http://www.both.org/?page_id=1183
|
||||
[8]: mailto:chrony-dnssrv@.timer
|
||||
[9]: mailto:mdadm-last-resort@.timer
|
||||
[10]: https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/index.html
|
||||
[11]: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet
|
||||
[12]: http://Freedesktop.org
|
||||
[13]: http://www.freedesktop.org/wiki/Software/systemd
|
||||
[14]: http://Linux.com
|
||||
[15]: https://www.linux.com/training-tutorials/more-systemd-fun-blame-game-and-stopping-services-prejudice/
|
||||
[16]: http://0pointer.de/blog/projects/systemd.html
|
||||
[17]: http://0pointer.de/blog/projects/systemd-for-admins-1.html
|
||||
[18]: http://0pointer.de/blog/projects/systemd-for-admins-2.html
|
||||
[19]: http://0pointer.de/blog/projects/systemd-for-admins-3.html
|
||||
[20]: http://0pointer.de/blog/projects/systemd-for-admins-4.html
|
||||
[21]: http://0pointer.de/blog/projects/three-levels-of-off.html
|
||||
[22]: http://0pointer.de/blog/projects/changing-roots
|
||||
[23]: http://0pointer.de/blog/projects/blame-game.html
|
||||
[24]: http://0pointer.de/blog/projects/the-new-configuration-files.html
|
||||
[25]: http://0pointer.de/blog/projects/on-etc-sysinit.html
|
||||
[26]: http://0pointer.de/blog/projects/instances.html
|
||||
[27]: http://0pointer.de/blog/projects/inetd.html
|
@ -0,0 +1,112 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Fixing “Unable to parse package file /var/lib/apt/lists” Error in Ubuntu and Other Linux Distributions)
|
||||
[#]: via: (https://itsfoss.com/unable-to-parse-package-file/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
|
||||
Fixing “Unable to parse package file /var/lib/apt/lists” Error in Ubuntu and Other Linux Distributions
|
||||
======
|
||||
|
||||
I have discussed a number of [Ubuntu update errors][1] in the past. If you [use the command line to update Ubuntu][2], you might run into some ‘errors’.
|
||||
|
||||
Some of these ‘errors’ are basically built-in features to prevent unwarranted changes to your system. I am not going into those details in this quick tutorial.
|
||||
|
||||
In this quick tip, I’ll show you how to tackle the following error that you could encounter while updating your system or installing new software:
|
||||
|
||||
**Reading package lists… Error!
|
||||
E: Unable to parse package file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease
|
||||
E: The package lists or status file could not be parsed or opened.**
|
||||
|
||||
A similar error can be encountered in Debian:
|
||||
|
||||
**E: Unable to parse package file /var/lib/apt/extended_states (1)**
|
||||
|
||||
There is absolutely no need to panic even thought it says ‘**The package cache file is corrupted**‘. This is really easy to ‘fix’.
|
||||
|
||||
### Handling “Unable to parse package file” error in Ubuntu and Debian-based Linux distributions
|
||||
|
||||
![][3]
|
||||
|
||||
Here’s what you need to do. Take a closer look at the name and path of the file the [Ubuntu][4] is complaining about.
|
||||
|
||||
Reading package lists… Error!
|
||||
**E: Unable to parse package file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease**
|
||||
E: The package lists or status file could not be parsed or opened.
|
||||
|
||||
For example, in the above error, it was complaining about /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease
|
||||
|
||||
This gives you the idea that something is not right with this file. Now all you need to do is to remove this file and regenerate the cache.
|
||||
|
||||
```
|
||||
sudo rm <file_that_is_not_parsed>
|
||||
```
|
||||
|
||||
So in my case, I could use this command: **sudo rm /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease** and then rebuild the cache with sudo apt update command.
|
||||
|
||||
#### Step by step for beginners
|
||||
|
||||
If you are familiar with Linux commands, you may know how to do delete the file with its absolute path. For novice users, let me guide you to safely delete the file.
|
||||
|
||||
First, you should go to the directory where the file is stored:
|
||||
|
||||
```
|
||||
cd /var/lib/apt/lists/
|
||||
```
|
||||
|
||||
Now delete the file which is not being parsed:
|
||||
|
||||
```
|
||||
sudo rm archive.ubuntu.com_ubuntu_dists_bionic_InRelease
|
||||
```
|
||||
|
||||
Now if you run the update again, the apt cache will be regenerated.
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
```
|
||||
|
||||
#### Too many files cannot be parsed?
|
||||
|
||||
This is fine if you have one or two files that are not being parsed while updating the system. But if the system complains about ten or twenty such files, removing them one by one is too tiring.
|
||||
|
||||
What you can do in such a case to remove the entire cache and then generate it again:
|
||||
|
||||
```
|
||||
sudo rm -r /var/lib/apt/lists/*
|
||||
sudo apt update
|
||||
```
|
||||
|
||||
#### Explanation of how it fixed your problem
|
||||
|
||||
The /var/lib/apt is the directory where files and data related to the apt package manager are stored. The /var/lib/apt/lists is the directory which is used for storing information for each package resource specified in your system’s sources.list.
|
||||
|
||||
In slightly non complicated terms, this /var/lib/apt/lists stores the package information cache. When you want to install or update a program, your system checks in this directory for the information on the said package. If it finds the detail on the package, then it goes to remote repository and actually download the program or its update.
|
||||
|
||||
When you run the “sudo apt update”, it builds the cache. This is why even when you remove everything in the /var/lib/apt/lists directory, running the update will build a fresh cache.
|
||||
|
||||
This is how it handles the issue of file not being parsed. Your system complained about a particular package or repository information that somehow got corrupted (either a failed download or manual change to sources.list). Removing that file (or everything) and rebuilding the cache solves the issue.
|
||||
|
||||
#### Still facing error?
|
||||
|
||||
This should fix the issue for you. But if the problem still persists or if you have some other related issue, let me know in the comment section and I’ll try to help you out.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/unable-to-parse-package-file/
|
||||
|
||||
作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/ubuntu-update-error/
|
||||
[2]: https://itsfoss.com/update-ubuntu/
|
||||
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/Unable-to-parse-package-file.png?ssl=1
|
||||
[4]: https://ubuntu.com/
|
@ -1,143 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (lxbwolf)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Drop PNG and JPG for your online images: Use WebP)
|
||||
[#]: via: (https://opensource.com/article/20/4/webp-image-compression)
|
||||
[#]: author: (Jeff Macharyas https://opensource.com/users/jeffmacharyas)
|
||||
|
||||
线上图片请抛弃 PNG 和 JPG 后缀:使用 WebP
|
||||
======
|
||||
了解一下这个开源的图片编辑工具来节省时间和空间。
|
||||
![Painting art on a computer screen][1]
|
||||
|
||||
WebP 是 2010 年 Google 开发的一种图片格式,能提供对网络图片的无损压缩和有损压缩。网络开发者们可以使用 WebP 来创建更小更丰富的图片,以此来提高网站的速度。更快的加载速度对于网站的用户体验和网站市场的效能是至关重要的。
|
||||
|
||||
为了提供领先于所有的设备和用户的图片加载能力,你网站上的图片文件大小不应该超过 500 KB。
|
||||
|
||||
WebP 无损图片通常比 PNG 图片文件小至少 25%。在相同的 SSIM(structural similarity,结构相似性)质量指标下,WebP 有损图片通常比 JPEG 图片小 25% 到 34%。
|
||||
|
||||
无损 WebP 也支持透明度。在有损 RGB 压缩可接受的情况下,有损 WebP 也支持透明度,PNG 文件的大小通常为 WebP 文件大小的四倍。
|
||||
|
||||
Google 报告把动图 GIF 文件转换为有损 WebP后文件大小减少了 64%,转换为无损 WebP 后文件大小减少了 19%。
|
||||
|
||||
WebP 文件格式是一种基于 RIFF(resource interchange file format,资源交换文件格式)的文档格式。你可以用 [hexdump][2] 看到文件的签名是 **52 49 46 46** (RIFF):
|
||||
|
||||
|
||||
```
|
||||
$ hexdump --canonical pixel.webp
|
||||
00000000 52 49 46 46 26 00 00 00 [...] |RIFF&...WEBPVP8 |
|
||||
00000010 1a 00 00 00 30 01 00 9d [...] |....0....*......|
|
||||
00000020 0e 25 a4 00 03 70 00 fe [...] |.%...p...`....|
|
||||
0000002e
|
||||
```
|
||||
|
||||
独立的 libwebp 库以 WebP 技术规范的引用实现的方式提供服务,可以从 Google 的 [Git 仓库][3] 或下载 tar 包获得。
|
||||
|
||||
全球在用的 80% 的 web 浏览器兼容 WebP 格式。本文撰写时,Apple 的 Safari 浏览器还不兼容。对于不兼容的情况,应变方法是在 WebP 图片旁边准备一张 JPG/PNG 图片,我们有很多种方法和 Wordpress 插件来实现。
|
||||
|
||||
### 为什么这很重要?
|
||||
|
||||
我的部分工作是设计和维护我们组织的网站。由于网站是个市场工具并且网站速度是衡量用户体验的重要指标,我一直致力于提高网站速度,通过把图片转换为 WebP 来减少图片大小是一个有效的解决方案。
|
||||
|
||||
我使用了 **web.dev** 来检测其中一个网页,该工具是由 Lighthouse 提供服务的,遵循 Apache 2.0 证书,可以在 <https://github.com/GoogleChrome/lighthouse> 找到。
|
||||
|
||||
根据官方描述,”LIghthouse 是一个开源的,旨在提升网页质量的自动化工具。你可以在任何网页上运行它 — 公共的或需要鉴权的。它有性能、可用性、积极的 web 应用、SEO和其他项目的审计。你可以使用命令行、作为一个 Node 模块或在 Chrome DevTools 里运行 Lighthouse。你输入一个 URL 给 Lighthouse,它对这个网页运行一系列的审计规则,之后生成这个网页的审计结果报告。从报告的失败审计条目中可以知道应该怎么优化网页。每条审计都有对应的文档解释为什么该项目是重要的,以及如何修复它。“
|
||||
|
||||
### 创建更小的 WebP 图片
|
||||
|
||||
我测试的页面返回了三张图片。在它生成的报告中,它提供了推荐和目标格式。我选择了它报告有 650 KB 的 ”app-graphic“ 图片。通过把它转换为 WebP 格式,预计可以图片大小降到 61 KB,节省 589 KB。我在 Photoshop 中把它转换了,用默认的 WebP 设置参数保存它,它的文件大小为 44.9 KB。比预期的还要好!从下面的 Photoshop 截图中可以看出,两张图在视觉上完全一样。
|
||||
|
||||
![WebP vs JPG comparison][4]
|
||||
|
||||
左图:650 KB(实际大小)。右图: 589 KB(转换之后的目标大小)。
|
||||
|
||||
当然,也可以用开源图片编辑工具 [GIMP][5] 把图片导出为 WebP。它提供了几个质量和压缩的参数:
|
||||
|
||||
![GIMP dialog for exporting webp, as a webp][6]
|
||||
|
||||
另一张图拉近视野后:
|
||||
|
||||
![WebP vs PNG comparison][7]
|
||||
|
||||
PNG(左图)和 WebP(右图),都是从 JPG 转换而来,两图对比可以看出 WebP 不仅在文件大小更小,在视觉质量上也更优秀。
|
||||
|
||||
### 把图片转换为 WebP
|
||||
|
||||
你也可以用 Linux 的命令行工具把图片从 JPG/PNG 转换为 WebP:
|
||||
|
||||
在命令行使用 **cwebp** 把 PNG 或 JPG 图片文件转换为 WebP 格式。你可以用下面的命令把 PNG 图片文件转换为质量参数为 80 的 WebP 图片。
|
||||
|
||||
|
||||
```
|
||||
`cwebp -q 80 image.png -o image.webp`
|
||||
```
|
||||
|
||||
你还可以用 [Image Magick][8],这个工具可能在你的发行版本软件仓库中可以找到。转换的子命令是 **convert**,它需要的所有参数就是输入和输出文件:
|
||||
|
||||
|
||||
```
|
||||
`convert pixel.png pixel.webp`
|
||||
```
|
||||
|
||||
### 使用编辑器把图片转换为 WebP
|
||||
|
||||
使用 [GIMP][9] 图片编辑器来把图片转换为 WebP。从 2.10 版本开始,它原生地支持 WebP。
|
||||
|
||||
如果你是 Photoshop 用户,由于 Photoshop 默认不包含 WebP,因此你需要一个转换插件。遵循 Apache License 2.0 证书发行的 WebPShop 0.2.1 是一个用户打开和保存包括动图在内的 WebP 图片的 Photoshop 模块,在 <https://github.com/webmproject/WebPShop> 可以找到。
|
||||
|
||||
为了能正常使用它,你需要把它放进 Photoshop 插件目录下的 **bin** 文件夹:
|
||||
|
||||
Windows x64—C:\Program Files\Adobe\Adobe Photoshop\Plug-ins\WebPShop.8bi
|
||||
|
||||
Mac—Applications/Adobe Photoshop/Plug-ins/WebPShop.plugin
|
||||
|
||||
### Wordpress 上的 WebP
|
||||
|
||||
很多网站是用 Wordpress 搭建的(我的网站就是)。因此,Wordpress 怎么上传 WebP 图片?本文撰写时,它还不支持。但是,当然已经有插件来满足这种需求,因此你可以在你的网站上同时准备 WebP 和 PNG/JPG 图片(为 Apple 用户)。
|
||||
|
||||
在 [Marius Hosting][11] 有下面的指示:
|
||||
|
||||
”直接向 Wordpress 上传 WebP 图片会怎样?这很简单。向你的主题 functions.php 文件添加几行内容就可以了。Wordpress 默认不支持展示和上传 WebP 文件,但是我会向你陈述怎么通过几个简单的步骤来让它支持。登录进你的 Wordpress 管理员界面,进入 Appearance/Theme Editor 找到 functions.php。拷贝下面的代码粘贴到文件最后并保存。
|
||||
|
||||
|
||||
```
|
||||
`//** *Enable upload for webp image files.*/ function webp_upload_mimes($existing_mimes) { $existing_mimes['webp'] = 'image/webp'; return $existing_mimes; } add_filter('mime_types', 'webp_upload_mimes');`
|
||||
```
|
||||
|
||||
"如果你想在 Media/Library 看缩略图预览,那么你需要把下面的代码也添加到 functions.php 文件。为了找到 functions.php 文件,进入 Appearance/Theme Editor 并搜索 functions.php,然后拷贝下面的代码粘贴到文件最后并保存。“
|
||||
|
||||
|
||||
```
|
||||
`//** * Enable preview / thumbnail for webp image files.*/ function webp_is_displayable($result, $path) { if ($result === false) { $displayable_image_types = array( IMAGETYPE_WEBP ); $info = @getimagesize( $path ); if (empty($info)) { $result = false; } elseif (!in_array($info[2], $displayable_image_types)) { $result = false; } else { $result = true; } } return $result; } add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2);`
|
||||
```
|
||||
|
||||
### WebP 和未来
|
||||
|
||||
WebP 是鲁棒的和最优的格式。它看起来更好,有更好的压缩率,它拥有其他大部分常见图片格式的所有特性。不必再等了,现在就使用它把。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/4/webp-image-compression
|
||||
|
||||
作者:[Jeff Macharyas][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[lxbwolf](https://github.com/lxbwolf)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jeffmacharyas
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/painting_computer_screen_art_design_creative.png?itok=LVAeQx3_ (Painting art on a computer screen)
|
||||
[2]: https://opensource.com/article/19/8/dig-binary-files-hexdump
|
||||
[3]: https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html
|
||||
[4]: https://opensource.com/sites/default/files/uploads/webp-vs-jpg-app-graphic.png (WebP vs JPG comparison)
|
||||
[5]: http://gimp.org
|
||||
[6]: https://opensource.com/sites/default/files/webp-gimp.webp (GIMP dialog for exporting webp, as a webp)
|
||||
[7]: https://opensource.com/sites/default/files/uploads/xcompare-png-left-webp-right.png (WebP vs PNG comparison)
|
||||
[8]: https://imagemagick.org
|
||||
[9]: https://en.wikipedia.org/wiki/GIMP
|
||||
[10]: https://mariushosting.com/how-to-upload-webp-files-on-wordpress/
|
||||
[11]: https://mariushosting.com/
|
@ -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