【PostgreSQL】- 1.2 PostgreSQL 配置单独的数据库存储

在 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
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值