在 Debian 或其它 Linux 系统上,为数据库创建一个单独的挂载点(如 /opt/pgdata)并将一块大容量硬盘挂载到这个目录有几个优点:数据隔离、性能优化、备份和恢复、安全性。
因此接上篇 “【PostgreSQL】- 1.1 在 Debian 12 上安装 PostgreSQL 15”,我在初始化之前先规划数据库的存储。
添加硬盘
新添加一块大容量硬盘,规划做为数据库的数据盘。
查看新硬盘
~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sr0 11:0 1 1024M 0 rom
vda 254:0 0 100G 0 disk
|-vda1 254:1 0 487M 0 part /boot
|-vda2 254:2 0 1K 0 part
`-vda5 254:5 0 99.5G 0 part
|-deb12ser--vg-root 253:0 0 98.6G 0 lvm /
`-deb12ser--vg-swap_1 253:1 0 980M 0 lvm [SWAP]
vdb 254:16 0 2T 0 disk
硬盘分区
找到新硬盘 vdb, 使用 fdisk 进行分区
~# su - root
Password:
~# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
The size of this disk is 2 TiB (2199023255552 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).
Created a new DOS (MBR) disklabel with disk identifier 0x7f500dd1

最低0.47元/天 解锁文章
3148

被折叠的 条评论
为什么被折叠?



