Ramroot-完全从内存运行Arch Linux!
使用Ramroot,我们可以完全从内存运行Arch Linux!是的,我们没看错。
它在系统引导时将整个根文件系统加载到内存中。
它是专为Arch Linux设计的。
Ramroot-完全从内存运行Arch Linux!
安装Ramroot
Ramroot在AUR中可用,因此我们可以使用任何AUR帮助程序进行安装,例如Yay。
$yay -S ramroot
然后,使用以下命令启用Ramroot:
$ramroot enable
输出示例:
:: Detected root UUID: 6517af02-68e9-484e-9dae-f0ed61822ad3 :: No /boot UUID detected. :: zram added to mkinitcpio.conf MODULES :: ext4 added to mkinitcpio.conf MODULES :: vfat added to mkinitcpio.conf MODULES :: ramroot added to mkinitcpio.conf HOOKS :: Enabling ramroot... [sudo] password for sk: ==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default' -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img ==> Starting build: 4.17.6-1-ARCH -> Running build hook: [base] -> Running build hook: [udev] -> Running build hook: [ramroot] -> Running build hook: [autodetect] -> Running build hook: [modconf] -> Running build hook: [block] -> Running build hook: [filesystems] -> Running build hook: [keyboard] -> Running build hook: [fsck] ==> Generating module dependencies ==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img ==> Image generation successful ==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback' -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect ==> Starting build: 4.17.6-1-ARCH -> Running build hook: [base] -> Running build hook: [udev] -> Running build hook: [ramroot] -> Running build hook: [modconf] -> Running build hook: [block] ==> WARNING: Possibly missing firmware for module: wd719x ==> WARNING: Possibly missing firmware for module: aic94xx -> Running build hook: [filesystems] -> Running build hook: [keyboard] -> Running build hook: [fsck] ==> Generating module dependencies ==> Creating gzip-compressed initcpio image: /boot/initramfs-linux-fallback.img ==> Image generation successful :: ramroot enabled.
如果由于某种原因它不起作用,请从GitHub存储库中获取Ramroot二进制文件,然后按如下所述运行它。
Git使用以下命令克隆Ramroot存储库:
$git clone https://github.com/arcmags/ramroot.git Cloning into 'ramroot'... remote: Counting objects: 94, done. remote: Compressing objects: 100% (52/52), done. remote: Total 94 (delta 41), reused 82 (delta 32), pack-reused 0 Unpacking objects: 100% (94/94), done.
上面的命令将在当前工作目录中创建一个名为“ ramroot”的文件夹,并将Ramroot项目的所有内容保存其中。
然后,转到Ramroot bin目录:
$cd ramroot/bin/
使以下文件成为可执行文件:
$chmod +x ramroot-build $chmod +x ramroot-enable
最后,运行以下命令以启用Ramroot。
$./ramroot-enable
出现提示时输入sudo或者root密码。
现在,重新启动系统。
在启动过程中,系统将提示我们将文件系统加载到内存中。
键入“是”继续。
请注意,如果检测到4G或者更大的内存,则此提示(y/N)默认为是,且超时时间为15秒。
由于我有2GiB 内存,因此必须键入“ Y”才能继续。
请稍等片刻以完成加载过程。
将整个根文件系统加载到内存需要几分钟。
确保系统上安装了足够的内存。
如果要保持更快的内存同步时间,请尝试保持干净且精简的系统。
删除旧的和不必要的程序包,并保持程序包缓存文件夹清洁。
如果使用最新的Ramroot版本,则已安装的内存大小至少应比根文件系统的大小大500MB。
如果内存至少比文件系统的大小多500MB,则会提示用户将根文件系统加载到内存。
如果根文件系统的大小小于已安装的内存,则最新的Ramroot版本不会在内存中加载根文件系统。
它甚至不会提示我们是否应该将文件系统加载到内存中。
文件系统将自动安装在本地磁盘中,并且Arch Linux将正常启动。
将根文件系统加载到内存中后,我们将进入rootfs提示符。
请注意,重启后将不会保存任何内容。
因为我们的Arch Linux完全从内存加载,而不是从本地磁盘加载。
删除Ramroot
重新启动系统,并在要求将文件系统加载到内存以正常登录到Arch Linux系统时键入“ n”。
转到ramroot/bin文件夹,并将以下文件作为可执行文件。
$cd ramroot/bin/ $chmod +x ramroot-disable $chmod +x ramroot-remove
最后,使用以下命令从Arch Linux系统中删除Ramroot:
$./ramroot-disable $./ramroot-remove
如果我们已经从AUR安装了Ramroot,请使用以下命令将其删除:
$ramroot disable
$ramroot remove
最后,删除Ramroot软件包:
$sudo pacman -Rns ramroot
有关更多详细信息,请参阅Ramroot帮助部分:
$ramroot --help NAME ramroot - load root (and /boot) filesystem entirely to 内存 during boot SYNOPSIS ramroot <ACTION> [OPTIONS] ACTIONS disable Remove ramroot from /etc/mkinitcpio.conf HOOKS. Remove ext4, vfat, and zram from /etc/mkinitcpio.conf MODULES. Rebuild linux cpio boot image. enable Rebuild build and runtime hooks in /usr/lib/initcpio. Add ramroot to /etc/mkinitcpio.conf HOOKS. Add ext4, vfat, and zram to /etc/mkinitcpio.conf MODULES. Rebuild linux cpio boot image. remove Disable ramroot. Remove build and runtime hooks from /usr/lib/initcpio. status Print ramroot and root filesystem status to screen. Return exit status 0 if enabled and currently loaded to 内存. Return exit status 1 if enabled and not loaded 内存. Return exit status 2 if disabled. OPTIONS -b, --boot <UUID> Specify /boot partition UUID to use when building hooks. -D, --dryrun Execute ACTION without making any changes. -F, --fstab Mount all other partitions in /etc/fstab normally. -H, --help Display help text and exit. -K, --keep Keep copies of new build and runtime hooks in ~/.cache/ramroot. -M, --message Print 'Arch on 内存' message at tty login by using custom /etc/issue. -N, --no Change startup prompt default to not load filesystem to 内存. -r, --root <UUID> Specify root partition UUID to use when building hooks. -t, --timeout <SECONDS> Set 内存 boot prompt timeout (default=15).
Ramroot对于希望在Arch Linux机器上进行测试的人可能会有所帮助。