背景说明环境介绍系统配置
扩容 / 空间配置内存交换分区挂载 /oradata 盘 背景说明
环境介绍临近下班时刻,客户笑嘻嘻的对我说:小陈,帮我装个数据库软件哈,下班前搞定哦…
我心想,这有啥难的,一下就搞定了!结果,是我大意了…
系统配置 扩容 / 空间小伙伴们看出问题了没有?
服务器的总空间大小只有10G?并且内存交换分区也没有配置…
没办法,只能找客户说明情况,结果…
行吧,逃不过,还是要苦逼的工程师去做配置…
客户在运维平台上将 / 空间扩大到了100G,后续的处理工作如下:
# 磁盘分区fdisk /dev/sdaCommand (m for help): pCommand (m for help): nPartition type: p primary (0 primary, 0 extended, 4 free) e extendedSelect (default p): Using default response pPartition number (1-4, default 1): First sector (20971519-209715153, default 20971519): Using default value 20971519Last sector, +sectors or +size{K,M,G} (20971519-209715153, default 67108863): Using default value 67108863Partition 1 of type Linux and of size 89 GiB is setCommand (m for help): tSelected partition 1Hex code (type L to list all codes): 8eChanged type of partition 'Empty' to 'Linux LVM'Command (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.# 重启机器生效分区reboot# 扩容 / 空间[root@dxgx_db ~]# pvcreate /dev/sda3 Physical volume "/dev/sda3" successfully created.[root@dxgx_db ~]# [root@dxgx_db ~]# vgs VG #PV #LV #SN Attr VSize VFree rhel 1 2 0 wz--n- <15.00g 0 [root@dxgx_db ~]# [root@dxgx_db ~]# vgextend rhel /dev/sda3 Volume group "rhel" successfully extended[root@dxgx_db ~]# [root@dxgx_db ~]# vgs VG #PV #LV #SN Attr VSize VFree rhel 2 2 0 wz--n- 98.99g <84.00g[root@dxgx_db ~]# [root@dxgx_db ~]# lvs LV VG Attr LSize Pool Origin Data% meta% Move Log Cpy%Sync Convert root rhel -wi-ao---- 10.00g var rhel -wi-ao---- <5.00g [root@dxgx_db ~]# [root@dxgx_db ~]# lvresize -L +83G /dev/mapper/rhel-root Size of logical volume rhel/root changed from 10.00 GiB (2560 extents) to 93.00 GiB (23808 extents). Logical volume rhel/root successfully resized.[root@dxgx_db ~]# [root@dxgx_db ~]# xfs_growfs /dev/mapper/rhel-rootmeta-data=/dev/mapper/rhel-root isize=512 agcount=4, agsize=655360 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0 spinodes=0data = bsize=4096 blocks=2621440, imaxpct=25 = sunit=0 swidth=0 blksnaming =version 2 bsize=4096 ascii-ci=0 ftype=1log =internal bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1realtime =none extsz=4096 blocks=0, rtextents=0data blocks changed from 2621440 to 24379392[root@dxgx_db ~]# # 查看扩容情况,成功扩容[root@dxgx_db ~]# df -ThFilesystem Type Size Used Avail Use% Mounted on/dev/mapper/rhel-root xfs 93G 4.2G 89G 5% /devtmpfs devtmpfs 2.0G 0 2.0G 0% /devtmpfs tmpfs 2.0G 0 2.0G 0% /dev/shmtmpfs tmpfs 2.0G 20M 2.0G 1% /runtmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup/dev/sda1 xfs 1014M 133M 882M 14% /boot/dev/mapper/rhel-var xfs 5.0G 716M 4.3G 15% /vartmpfs tmpfs 394M 0 394M 0% /run/user/0tmpfs tmpfs 60M 0 60M 0% /var/log/rtlog
配置内存交换分区由于操作系统模板没有配置内存交换分区,经与客户沟通,添加一块 32G 磁盘用作配置内存交换分区空间使用。
操作步骤如下:
[root@dxgx_db ~]# fdisk /dev/sdcCommand (m for help): pCommand (m for help): nPartition type: p primary (0 primary, 0 extended, 4 free) e extendedSelect (default p): Using default response pPartition number (1-4, default 1): First sector (2048-67108863, default 2048): Using default value 2048Last sector, +sectors or +size{K,M,G} (2048-67108863, default 67108863): Using default value 67108863Partition 1 of type Linux and of size 32 GiB is setCommand (m for help): tSelected partition 1Hex code (type L to list all codes): 82Changed type of partition 'Empty' to 'Linux swap / Solaris'Command (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.[root@dxgx_db ~]# partprobe /dev/sdc[root@dxgx_db ~]# [root@dxgx_db ~]# mkswap /dev/sdc1 Setting up swapspace version 1, size = 33553404 KiBno label, UUID=8afade50-5a74-470a-8b20-f91259835add[root@dxgx_db ~]# cat /etc/fstab /dev/mapper/rhel-root / xfs defaults 0 0UUID=1cd47eed-46e1-4b12-bc7c-8e9a9153c8f4 /boot xfs defaults 0 0/dev/mapper/rhel-var /var xfs defaults 0 0/dev/sdc1 swap swap defaults 0 0[root@dxgx_db ~]# swapon /dev/sdc1 [root@dxgx_db ~]# [root@dxgx_db ~]# free -h total used free shared buff/cache availableMem: 15G 465M 15G 19M 233M 15GSwap: 31G 0B 31G
挂载 /oradata 盘客户再划了一块 200G 的硬盘作为数据盘,让我挂载…
[root@dxgx_db ~]# fdisk /dev/sdbCommand (m for help): pCommand (m for help): nPartition type: p primary (0 primary, 0 extended, 4 free) e extendedSelect (default p): Using default response pPartition number (1-4, default 1): First sector (2048-419430326, default 2048): Using default value 2048Last sector, +sectors or +size{K,M,G} (2048-419430326, default 419430326): Using default value 419430326Partition 1 of type Linux and of size 199 GiB is setCommand (m for help): tSelected partition 1Hex code (type L to list all codes): 8eChanged type of partition 'Empty' to 'Linux LVM'Command (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.# 磁盘文件系统格式化[root@dxgx_db ~]# mkfs.xfs /dev/sdb1# 创建挂载点[root@dxgx_db ~]# mkdir -p /oradata[root@dxgx_db ~]# chown oracle.oinstall /oradata[root@dxgx_db ~]# cat /etc/fstab /dev/mapper/rhel-root / xfs defaults 0 0UUID=1cd47eed-46e1-4b12-bc7c-8e9a9153c8f4 /boot xfs defaults 0 0/dev/mapper/rhel-var /var xfs defaults 0 0/dev/sdb1 /oradata xfs defaults 0 0/dev/sdc1 swap swap defaults 0 0[root@dxgx_db ~]# mount -a[root@dxgx_db ~]# df -ThFilesystem Type Size Used Avail Use% Mounted on/dev/mapper/rhel-root xfs 93G 4.2G 89G 5% /devtmpfs devtmpfs 2.0G 0 2.0G 0% /devtmpfs tmpfs 2.0G 0 2.0G 0% /dev/shmtmpfs tmpfs 2.0G 20M 2.0G 1% /runtmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup/dev/sda1 xfs 1014M 133M 882M 14% /boot/dev/mapper/rhel-var xfs 5.0G 716M 4.3G 15% /vartmpfs tmpfs 394M 0 394M 0% /run/user/0tmpfs tmpfs 60M 0 60M 0% /var/log/rtlog/dev/sdb1 xfs 199G 0 199G 0% /oradata[root@dxgx_db ~]# chown oracle.oinstall /oradata