mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-22 23:00:57 +08:00
translated
This commit is contained in:
parent
5b67042090
commit
2aed4ad38a
@ -1,126 +0,0 @@
|
||||
[#]: subject: "Install Linux with LVM"
|
||||
[#]: via: "https://opensource.com/article/21/8/install-linux-mint-lvm"
|
||||
[#]: author: "Kenneth Aaron https://opensource.com/users/flyingrhino"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Install Linux with LVM
|
||||
======
|
||||
A tutorial on getting Linux Mint 20.2 working with logical volume
|
||||
manager (LVM).
|
||||
![Linux keys on the keyboard for a desktop computer][1]
|
||||
|
||||
A couple of weeks ago, the good folks at [Linux Mint][2] released version 20.2 of their open source operating system. The installer built into the live ISO is excellent and only requires a few clicks to install the OS. You even have a built-in partitioner if you want to customize your partitions.
|
||||
|
||||
The installer is mainly focused on a simple install—define your partitions and install into them. For those wanting a more flexible setup—[logical volume manager][3] (LVM) is the way to go—you benefit from setting up volume groups and define your logical volumes within them.
|
||||
|
||||
LVM is a hard drive management system that allows you to create storage space across multiple physical drives. In other words, you could "tether" a few small drives together so your OS treats them as if they were one drive. Beyond that, it has the advantages of live resizing, file system snapshots, and much more. This article isn't a tutorial on LVM (the web is full of [good information on that already][4].) Instead, I aim to keep this page on topic and focus solely on getting Linux Mint 20.2 working with LVM.
|
||||
|
||||
As a desktop OS, the installer is kept simple, and installing LM 20.2 on LVM is slightly more involved but not too complicated. If you select LVM in the installer, you get a setup that's been defined by the Linux Mint devs, and you have no control over the individual volumes at the time of install.
|
||||
|
||||
However, there's a solution—right there in the live ISO—and that solution only requires a few commands in the terminal to set up the LVM, after which you resume the regular installer to complete the job.
|
||||
|
||||
I'm using Linux Mint 20.2 with the [XFCE desktop][5] for my install, but the procedure is similar for the other LM desktops.
|
||||
|
||||
### Partitioning the drive
|
||||
|
||||
In the Linux Mint live ISO, you have access to Linux command-line tools through the terminal and GUI tools. If you need to do any partition work, you can use the command-line `fdisk` or `parted` commands, or the GUI application `gparted`. I want to keep these instructions simple enough for anyone to follow, so I'll use GUI tools where possible and command-line tools where necessary.
|
||||
|
||||
Start by creating a couple of partitions for the install.
|
||||
|
||||
Using `gparted` (launched from the menu), complete the following:
|
||||
|
||||
First, create a partition of 512 MB of type **FAT32** (this is used to ensure the system is bootable.) 512 MB is overkill for most, and you can get away with 256 MB or even less, but with today's big disks, allocating even 512 MB is not a significant concern.
|
||||
|
||||
![Creating a boot partition][6]
|
||||
|
||||
CC BY-SA Seth Kenlon
|
||||
|
||||
Next, create a partition of the rest of the disk of type `lvm2 pv` (this is where your LVM will be.)
|
||||
|
||||
![Partition layout][7]
|
||||
|
||||
CC BY-SA Seth Kenlon
|
||||
|
||||
Now open a terminal window, and escalate your privileges to root:
|
||||
|
||||
|
||||
```
|
||||
$ sudo -s
|
||||
# whoami
|
||||
root
|
||||
```
|
||||
|
||||
Next, you must locate the LVM member (the big partition) you created earlier. Use one of the following commands: `lsblk -f` or `pvs` or `pvscan`.
|
||||
|
||||
|
||||
```
|
||||
# pvs
|
||||
PV VG Fmt [...]
|
||||
/dev/sda2 lvm2 [...]
|
||||
```
|
||||
|
||||
In my case, the partition is located at `/dev/sda2`, but you should replace this with whatever you get in your output.
|
||||
|
||||
Now that you know what device designation your partition has, you can create an LVM volume group there:
|
||||
|
||||
|
||||
```
|
||||
`# vgcreate vg /dev/sda2`
|
||||
```
|
||||
|
||||
You can see the details of the volume group you created using `vgs `or `vgscan`.
|
||||
|
||||
Create the logical volumes you want to use during install. I'm keeping it simple by creating one for the root partition (`/`) and one for `swap`, but you can create more as needed (for example, a separate partition for `/home`.)
|
||||
|
||||
|
||||
```
|
||||
# lvcreate -L 80G -n root vg
|
||||
# lvcreate -L 16G -n swap vg
|
||||
```
|
||||
|
||||
The partition sizes in my examples are arbitrary and based on what I have available. Use partition sizes that make sense for your drive.
|
||||
|
||||
You can view the logical volumes with `lvs` or `lvdisplay`.
|
||||
|
||||
That's it for the terminal.
|
||||
|
||||
### Installing Linux
|
||||
|
||||
Now start the installer program from the desktop icon:
|
||||
|
||||
* Once you get to the **Installation type**, select **Something else**.
|
||||
* Edit the 512 Mb partition and change it to `EFI`.
|
||||
* Edit the root LV and change it to `ext4` (or a file system of your choice). Select to mount it as root and select to format it.
|
||||
* Edit the swap partition and set it as `swap`.
|
||||
* Continue the install process normally—Linux Mint installer puts the files in the correct places and creates the mount points for you.
|
||||
|
||||
|
||||
|
||||
That's it—enjoy the power of LVM in your Linux Mint install.
|
||||
|
||||
If ever you need to resize partitions or do any advanced work on the system—you'll be thankful for choosing LVM.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/8/install-linux-mint-lvm
|
||||
|
||||
作者:[Kenneth Aaron][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/flyingrhino
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer)
|
||||
[2]: https://linuxmint.com/
|
||||
[3]: https://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)
|
||||
[4]: https://opensource.com/business/16/9/linux-users-guide-lvm
|
||||
[5]: https://opensource.com/article/19/12/xfce-linux-desktop
|
||||
[6]: https://opensource.com/sites/default/files/boot-part.png (Creating a boot partition)
|
||||
[7]: https://opensource.com/sites/default/files/part-layout.png (Partition layout)
|
126
translated/tech/20210813 Install Linux with LVM.md
Normal file
126
translated/tech/20210813 Install Linux with LVM.md
Normal file
@ -0,0 +1,126 @@
|
||||
[#]: subject: "Install Linux with LVM"
|
||||
[#]: via: "https://opensource.com/article/21/8/install-linux-mint-lvm"
|
||||
[#]: author: "Kenneth Aaron https://opensource.com/users/flyingrhino"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
用 LVM 安装 Linux
|
||||
======
|
||||
一个关于让 Linux Mint 20.2 与逻辑卷管理器(LVM)一起工作的教程。
|
||||
![Linux keys on the keyboard for a desktop computer][1]
|
||||
|
||||
几周前,[Linux Mint][2] 的人员发布了他们的开源操作系统的 20.2 版本。Live ISO 中内置的安装程序非常好,只需要点击几下就可以安装操作系统。如果你想定制你的分区,你甚至有一个内置的分区器。
|
||||
|
||||
安装程序主要集中在简单的安装上:定义你的分区并安装到这些分区。对于那些想要更灵活的设置的人来说,[逻辑卷管理器][3] (LVM)是个不错的选择,你可以通过设置卷组并在其中定义你的逻辑卷。
|
||||
|
||||
LVM 是一个硬盘管理系统,允许你在多个物理驱动器上创建存储空间。换句话说,你可以把几个小驱动器“拴”在一起,这样你的操作系统就会把它们当作一个驱动器。除此之外,它还有实时调整大小、文件系统快照和更多的优点。这篇文章并不是关于 LVM 的教程(网上已经有很多[这方面不错的信息][4]了)。 相反,我的目标是保持这个页面的主题,只关注让 Linux Mint 20.2 与 LVM 一起工作。
|
||||
|
||||
作为一个桌面操作系统,安装程序很简单,在 LVM 上安装 LM 20.2 略微复杂一些,但不会太复杂。如果你在安装程序中选择了 LVM,你会得到一个由 Linux Mint 开发者定义的设置,而且你在安装时无法控制各个卷。
|
||||
|
||||
然而,有一个解决方案:在 Live ISO 中,该方案只需要在终端中的几个命令来设置 LVM,然后你继续使用常规安装程序来完成工作。
|
||||
|
||||
我安装了 Linux Mint 20.2 和 [XFCE 桌面][5],但其他 LM 桌面的过程也类似。
|
||||
|
||||
### 分区驱动器
|
||||
|
||||
在 Linux Mint live ISO 中,你可以通过终端和 GUI 工具访问 Linux 命令行工具。如果你需要做任何分区工作,你可以使用命令行 `fdisk` 或 `parted` 命令,或者 GUI 应用 `gparted`。我想让这些说明简单到任何人都能遵循,所以我会在可能的情况下使用 GUI 工具,在必要时使用命令行工具。
|
||||
|
||||
首先,为安装创建几个分区。
|
||||
|
||||
使用 `gparted` (从菜单中启动),完成以下工作:
|
||||
|
||||
首先,创建一个 512MB 的分区,类型为 **FAT32**(这是用来确保系统可启动)。512MB 对大多数人来说是多余的,你可以用 256MB 甚至更少,但在今天的大磁盘中,即使分配 512MB 也不是什么大问题。
|
||||
|
||||
![Creating a boot partition][6]
|
||||
|
||||
CC BY-SA Seth Kenlon
|
||||
|
||||
接下来,在磁盘的其余部分创建一个 `lvm2 pv` 类型的分区(这是你的 LVM 的位置)。
|
||||
|
||||
![Partition layout][7]
|
||||
|
||||
CC BY-SA Seth Kenlon
|
||||
|
||||
现在打开一个终端窗口,并将你的权限提升到 root:
|
||||
|
||||
|
||||
```
|
||||
$ sudo -s
|
||||
# whoami
|
||||
root
|
||||
```
|
||||
|
||||
接下来,你必须找到你之前创建的 LVM 成员(大分区)。使用下列命令之一: `lsblk -f` 或 `pvs` 或 `pvscan`。
|
||||
|
||||
|
||||
```
|
||||
# pvs
|
||||
PV VG Fmt [...]
|
||||
/dev/sda2 lvm2 [...]
|
||||
```
|
||||
|
||||
在我的例子中,该分区位于 `/dev/sda2`,但你应该用你的输出中得到的内容来替换它。
|
||||
|
||||
现在你知道了你的分区有哪些设备,你可以在那里创建一个 LVM 卷组:
|
||||
|
||||
|
||||
```
|
||||
`# vgcreate vg /dev/sda2`
|
||||
```
|
||||
|
||||
你可以使用 `vgs` 或 `vgscan` 看到你创建的卷组的细节。
|
||||
|
||||
创建你想在安装时使用的逻辑卷。为了简单,我分别创建了根分区(`/`)和 `swap` 分区,但是你可以根据需要创建更多的分区(例如,为 `/home` 创建一个单独的分区)。
|
||||
|
||||
|
||||
```
|
||||
# lvcreate -L 80G -n root vg
|
||||
# lvcreate -L 16G -n swap vg
|
||||
```
|
||||
|
||||
我的例子中的分区大小是任意的,是基于我可用的。使用对你的硬盘有意义的分区大小。
|
||||
|
||||
你可以用 `lvs` 或 `lvdisplay` 查看逻辑卷。
|
||||
|
||||
终端到这就结束了。
|
||||
|
||||
### 安装 Linux
|
||||
|
||||
现在从桌面上的图标启动安装程序:
|
||||
|
||||
* 进入 **Installation type**,选择 **Something else**。
|
||||
* 编辑 512Mb 的分区并将其改为 `EFI`。
|
||||
* 编辑根 LV,将其改为 `ext4`(或一个你选择的文件系统)。选择将其挂载为根目录,并选择将其格式化。
|
||||
* 编辑交换分区并将其设置为`swap`。
|
||||
* 继续正常的安装过程。Linux Mint 安装程序会将文件放在正确的位置并为你创建挂载点。
|
||||
|
||||
|
||||
|
||||
|
||||
完成了。在你的 Linux Mint 安装中享受 LVM 的强大。
|
||||
|
||||
如果你需要调整分区大小或在系统上做任何高级工作,你会感谢选择 LVM。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/8/install-linux-mint-lvm
|
||||
|
||||
作者:[Kenneth Aaron][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://opensource.com/users/flyingrhino
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer)
|
||||
[2]: https://linuxmint.com/
|
||||
[3]: https://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)
|
||||
[4]: https://opensource.com/business/16/9/linux-users-guide-lvm
|
||||
[5]: https://opensource.com/article/19/12/xfce-linux-desktop
|
||||
[6]: https://opensource.com/sites/default/files/boot-part.png (Creating a boot partition)
|
||||
[7]: https://opensource.com/sites/default/files/part-layout.png (Partition layout)
|
Loading…
Reference in New Issue
Block a user