将 /var 分离到另一个驱动器的正确方法是什么?

将 /var 分离到另一个驱动器的正确方法是什么?

我将在我的机器上安装的软件提供了以下说明:

SWAP - Refer to the OS vendor recommendation (usually at least the amount of RAM on the server times two).
/ - 20GB minimum, 50GB recommended. This partition will be used for the OS updates.
/tmp - At least 3GB recommended.
/var - The rest of the unallocated disk space.

我有以下 2 个驱动器:

1. SSD (120GB)
2. HDD (4TB)

当然,我想把所有东西都安装在固态硬盘以及/var硬盘


我是分区方面的新手,所以如果有人告诉我我是否做得正确,我将非常感激。

截屏

DF-H

Filesystem                Size  Used Avail Use% Mounted on
devtmpfs                  7.8G     0  7.8G   0% /dev
tmpfs                     7.8G     0  7.8G   0% /dev/shm
tmpfs                     7.8G   17M  7.8G   1% /run
tmpfs                     7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/mapper/centos-root    56G  2.8G   53G   5% /
/dev/sda1                 2.0G  163M  1.9G   8% /boot
/dev/mapper/centos-tmp    6.0G   33M  6.0G   1% /tmp
/dev/mapper/centos00-var  3.7T  293M  3.7T   1% /var
tmpfs                     1.6G     0  1.6G   0% /run/user/0

fdisk -l

Disk /dev/sda: 120.0 GB, 120034123776 bytes, 234441648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0008ca6e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     4196351     2097152   83  Linux
/dev/sda2         4196352   234440703   115122176   8e  Linux LVM
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/sdb: 4000.8 GB, 4000787030016 bytes, 7814037168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: gpt
Disk identifier: C137EFF4-8B1E-44BE-8877-C03B68E22289


#         Start          End    Size  Type            Name
 1         2048   7814035455    3.7T  Linux LVM       

Disk /dev/mapper/centos-root: 59.9 GB, 59898855424 bytes, 116989952 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-swap: 51.5 GB, 51539607552 bytes, 100663296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-tmp: 6442 MB, 6442450944 bytes, 12582912 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos00-var: 4000.8 GB, 4000783007744 bytes, 7814029312 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

答案1

是的,您对您提出的配置很满意。

好点子:巨大的 /var 分区位于使用通用运输分区表(又名“磁盘标签” - 这是分区的类型)。这对于分区大小 > 2TB 的磁盘是必需的。

另一件好事(从我的观点和我的经验来看)是:安装程序建议您使用 LVM,并且您遵循了此建议。在某些情况下,这将使将来更改分区大小或将文件系统(“卷”)迁移到另一个磁盘变得更容易。

由于操作系统安装程序为您完成了所有工作,因此您不必担心磁盘访问中的额外层。

相关内容