博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
98rat_如何使用E4rat将Linux PC的启动时间缩短一半
阅读量:2523 次
发布时间:2019-05-11

本文共 8880 字,大约阅读时间需要 29 分钟。

98rat

98rat

banner-01

Linux is pretty quick to boot on modern computers, but why not pare it down some more? If you’re hurting from a lack of SSD or just want to boot faster, E4rat will easily shave down your boot time.

Linux可以在现代计算机上快速启动,但是为什么不减少它呢? 如果您因缺少SSD而受到伤害或者只是想更快地启动,E4rat可以轻松缩短启动时间。

Note: this article was written for Ubuntu 11.04 so it’s very possible that it doesn’t work anymore.

注意:本文是针对Ubuntu 11.04编写的,因此很可能不再起作用。

E4rat和您Linux PC (E4rat and Your Linux PC)

E4rat is a utility that’s designed to cut your Linux boot time drastically. Essentially you show it what you do when you start your computer normally, and it analyzes the files you access and use. Then, it’ll move them to the beginning of your hard disk so that it takes less time to find them during boot.

E4rat是一个实用程序,旨在极大地减少Linux的启动时间。 从本质上讲,它向您显示了正常启动计算机时的操作,并分析了您访问和使用的文件。 然后,它将它们移动到硬盘的开头,以便在启动过程中找到它们所需的时间更少。

E4rat is designed to work with Ext4 partitions only. If you’re using another file system, this isn’t for you. There are reports of it working with but your mileage may vary, so be careful if you have sensitive data.

E4rat仅设计用于Ext4分区。 如果您使用的是其他文件系统,则不适合您。 有报告称它可以与一起使用,但是您的里程可能会有所不同,因此,如果您有敏感数据,请小心。

Furthermore, if you have an SSD, you should stay away from this. Because E4rat moves files for a better seek time, SSD uses won’t see any benefit as their “seek” time is unaffected by this. By moving files and performing extended writes, you may even end up damaging your already-blazing-fast drive.

此外,如果您有SSD,则应远离此位置。 由于E4rat可以以更好的查找时间移动文件,因此SSD使用不会带来任何好处,因为它们的“查找”时间不受此影响。 通过移动文件并执行扩展写入,您甚至可能损坏已经非常快的驱动器。

在Ubuntu上安装E4rat (Installing E4rat on Ubuntu)

E4rat is available as a .deb package for Ubuntu users. If you’re running another Linux distro you’ll have to compile E4rat from source, but things should work fine and you can still largely follow this guide. The only real exception is for people who use Debian – take a look at before you continue. For our step-by-step guide, we’ll assume you’re running Ubuntu Natty (11.04).

E4rat可作为.deb软件包供Ubuntu用户使用。 如果您正在运行另一个Linux发行版,则必须从源代码编译E4rat,但是一切正常,您仍然可以很大程度上遵循本指南。 唯一真正的例外是使用Debian的用户–在继续之前请先阅读。 对于我们的分步指南,我们假设您正在运行Ubuntu Natty(11.04)。

Head over to E4rat’s .

转至E4rat的。

Google Chrome_001

Click on the latest version, then download the file that’s appropriate for your architecture.

单击最新版本,然后下载适合您的体系结构的文件。

Google Chrome_002

I’m running a 64-bit installation of Ubuntu Natty, so I chose the “amd64” version.

我正在运行Ubuntu Natty的64位安装,因此我选择了“ amd64”版本。

Now, if you try to install it right now, you’ll get an error because Ubuntu’s default “ureadahead” package conflicts with E4rat.

现在,如果您尝试立即安装它,则会收到错误消息,因为Ubuntu的默认“ ureadahead”软件包与E4rat冲突。

Ubuntu Software Center_008

Ureadahead is similar in concept, but doesn’t work as well as E4rat, so let’s get rid of it. Open up a terminal and enter the following command.

Ureadahead在概念上相似,但效果不如E4rat,所以让我们摆脱它。 打开一个终端并输入以下命令。

sudo dpkg –purge ureadahead ubuntu-minimal

sudo dpkg –最小清除尿素头

term_001

Enter your password and let it do its thing. Next, let’s make sure the proper dependencies for E4rat are present.

输入您的密码,然后做它的事情。 接下来,让我们确保存在E4rat的正确依赖项。

sudo apt-get install libblkid1 e2fslibs

sudo apt-get install libblkid1 e2fslibs

term_002

You should have them already installed by default, but if not, this command will install/upgrade to the latest version.

默认情况下,您应该已经安装了它们,但是如果没有,则此命令将安装/升级到最新版本。

Now when you double-click the .deb file you downloaded, you won’t see that error and you can just click the Install button.

现在,当您双击下载的.deb文件时,您将不会看到该错误,只需单击“安装”按钮即可。

Ubuntu Software Center_012

I happened to get an error at this point, but you can just click on ignore if you get it. Once everything’s done, restart your computer, but stay at the Grub menu.

我此时碰巧遇到了一个错误,但是如果您发现错误,则可以单击“忽略”。 完成所有操作后,请重新启动计算机,但请保留在Grub菜单中。

收集数据 (Gathering Data)

With E4rat installed, we need to make sure it gathers its data properly. To do this, we can edit the parameters for our next boot. Make sure you’re in the Grub menu.

安装了E4rat之后,我们需要确保它正确收集了数据。 为此,我们可以编辑下一次引导的参数。 确保您在Grub菜单中。

Photo Aug 05, 3 42 58 AM

Highlight the option you normally use to boot into Linux and hit the “e” key. Look for the line that starts with:

突出显示通常用于启动Linux的选项,然后按“ e”键。 查找以以下内容开头的行:

linux /boot/vmlinuz…

linux / boot / vmlinuz…

Photo Aug 05, 3 45 14 AM

It’s the second-to-last line in the above pic (click on the image to see a larger version). This line is what tells the Linux kernel to load. At the end of this line, add the following:

这是上图的倒数第二行(单击图像查看大图)。 这行告诉Linux内核加载。 在此行的末尾,添加以下内容:

init=/sbin/e4rat-collect

init = / sbin / e4rat-collect

Photo Aug 05, 3 45 21 AM

Then, just hit Ctrl+X to continue booting. This tells E4rat’s collect program to start running after boot. Let your computer do its thing, and log in. For the next two minutes you should do what you normally do when once you log in. For me, that entails loading up both Chrome and Firefox, opening terminal and running , and getting Nautilus and Shutter opened so I can check my files and take screenshots.

然后,只需按Ctrl + X即可继续启动。 这告诉E4rat的收集程序在启动后开始运行。 让您的计算机完成其工作,然后登录。在接下来的两分钟内,您应该执行登录后通常的操作。对我来说,这需要加载Chrome和Firefox,打开终端并运行 ,以及打开Nautilus和Shutter,以便检查文件并截图。

desktop

As you can see, those first two minutes are pretty crucial. I clicked on everything within that two minute window that E4rat uses, but not everything loaded until several minutes later. That’s okay, though, so long as you start the application loading, you’ll be fine.

如您所见,前两分钟非常关键。 我单击了E4rat使用的两分钟窗口内的所有内容,但直到几分钟后才加载所有内容。 没关系,但是,只要您开始加载应用程序,就可以了。

Let’s check to make sure the proper log file was created. Open up terminal.

让我们检查以确保创建了正确的日志文件。 打开终端。

ls /var/lib/e4rat/

ls / var / lib / e4rat /

check

You should see a file a displayed that’s named “startup.log”. If this file isn’t created, you’ll need to restart the process.

您应该看到显示的文件名为“ startup.log”。 如果未创建此文件,则需要重新启动该过程。

移动启动文件 (Moving the Startup Files)

Once you verify that the log file is there, restart your computer and stop at the Grub screen. Choose your booting option and hit “e” once again.

确认日志文件存在后,重新启动计算机并在Grub屏幕上停止。 选择启动选项,然后再次点击“ e”。

This time, we’re going to add some thing different to the end of that same line:

这次,我们将在同一行的末尾添加一些不同的内容:

single

Photo Aug 05, 3 55 58 AM

Hit Ctrl+X to boot, but this time, we’re heading into the command-line straight-away. My machine took a little while, and then gave me a screen with several option. If this happens to you, just choose the option for “Resume normal boot.”

按Ctrl + X引导,但是这次,我们直接进入命令行。 我的机器花了一段时间,然后给了我一个带有多个选项的屏幕。 如果您遇到这种情况,只需选择“恢复正常启动”选项即可。

Photo Aug 05, 3 59 21 AM

Then, if you don’t get to a command-prompt, hit Ctrl+Alt+F1. You should now see a login prompt.

然后,如果没有出现命令提示符,请按Ctrl + Alt + F1。 现在,您应该会看到一个登录提示。

Photo Aug 05, 3 59 59 AM

Enter your username and password, and then enter the following command:

输入您的用户名和密码,然后输入以下命令:

sudo e4rat-realloc /var/lib/e4rat/startup.log

须藤e4rat-realloc /var/lib/e4rat/startup.log

Photo Aug 05, 4 01 19 AM

Enter your password, and E4rat will start moving files on your hard drive.

输入密码,E4rat将开始在硬盘驱动器上移动文件。

Photo Aug 05, 4 01 29 AM

This may take quite a while depending on how cluttered your disk is. Just watch the hard drive light blink and wait patiently for things to finish.

这可能需要花费相当长的时间,具体取决于磁盘的混乱程度。 只需看着硬盘驱动器指示灯闪烁并耐心等待事情完成即可。

Photo Aug 05, 4 01 49 AM

The official website recommends that you run the command a couple more times until nothing else can be moved. My computer gave me that message right away, so your mileage may vary.

官方网站建议您多次运行该命令,直到无法移动其他内容为止。 我的计算机立即向我发送了该消息,因此您的里程可能会有所不同。

Photo Aug 05, 4 03 46 AM

Now, let’s restart our machine with

现在,让我们重启机器

sudo shutdown -r now

sudo shutdown -r现在

and log in normally to complete the last phase.

并正常登录以完成最后一个阶段。

配置Grub在每次引导时运行E4rat (Configuring Grub to Run E4rat On Every Boot)

Open up a terminal and enter:

打开一个终端并输入:

gksu gedit /etc/default/grub

gksu gedit / etc / default / grub

Ubuntu’s Text Editor should pop open. Look for the line that starts with “GRUB_CMDLINE_LINUX_DEFAULT=”

Ubuntu的文本编辑器应该弹出打开。 查找以“ GRUB_CMDLINE_LINUX_DEFAULT =”开头的行

gedit_001

We’re going to add a line inside of the those quotes and before whatever options are there.

我们将在这些引号内以及任何选项之前添加一行。

init=/sbin/e4rat-preload

init = / sbin / e4rat-preload

Your file should look similar to this:

您的文件应类似于以下内容:

gedit_002

Hit the save button and close Gedit. Now, return to the terminal and run one last command:

点击保存按钮,然后关闭Gedit。 现在,返回到终端并运行最后一个命令:

sudo update-grub

须藤更新

term_004

Configuring Grub this way (and NOT by editing /boot/grub/grub.cfg) will make sure that this lasts between updates, although you may have to redo this if you upgrade between releases in the future. By then, however, you’ll probably want to redo this entire process so that the right files are in the right places.

以这种方式配置Grub(而不是通过编辑/boot/grub/grub.cfg进行配置)将确保这种情况在更新之间持续存在,但是如果将来在不同的发行版之间进行升级,则可能必须重做一次。 但是,到那时,您可能需要重做整个过程,以便将正确的文件放在正确的位置。

The next time you reboot, you’ll notice a sizeable time difference in booting and in opening the apps that your normally head straight to. My netbook’s boot time is now about 10 seconds!

下次重新启动时,您会注意到在启动和打开通常直接进入的应用程序时存在很大的时差。 我的上网本的启动时间现在约为10秒!



Know of any other tricks to shave precious seconds off of your boot time? Share what you know in the comments!

知道其他任何技巧可以节省宝贵的启动时间吗? 在评论中分享您所知道的!

翻译自:

98rat

转载地址:http://unawd.baihongyu.com/

你可能感兴趣的文章
unity3d 射弹基础案例代码分析
查看>>
thinksns 分页数据
查看>>
os模块
查看>>
LINQ to SQL vs. NHibernate
查看>>
基于Angular5和WebAPI的增删改查(一)
查看>>
windows 10 & Office 2016 安装
查看>>
最短路径(SP)问题相关算法与模板
查看>>
js算法之最常用的排序
查看>>
Python——交互式图形编程
查看>>
经典排序——希尔排序
查看>>
团队编程项目作业2-团队编程项目代码设计规范
查看>>
英特尔公司将停止910GL、915GL和915PL芯片组的生产
查看>>
团队编程项目作业2-团队编程项目开发环境搭建过程
查看>>
cookie
查看>>
<Using parquet with impala>
查看>>
07-Java 中的IO操作
查看>>
uclibc,eglibc,glibc之间的区别和联系【转】
查看>>
通过镜像下载Android系统源码
查看>>
Chap-6 6.4.2 堆和栈
查看>>
C# MySql 连接
查看>>