更新:新买的4T硬盘创建分区只有2T,后来使用gparted分区
https://cloud.tencent.com/developer/article/1499332
==============================================================
WCS系统当设备很多时产生的日志非常多,几天就没了,默认是/分配了50G,但是现场比较多的情况系统运行一段时间后磁盘空间满,导致数据库查询失败,登录失败。
从最开始说起,一般客户私有云部署好之后,软件安装的分区比较小,但同时有分配比较大的数据盘,需要自行设置。
1.查看当前分区情况
[root@jx-t---02 ~]# 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 65M 7.7G 1% /run tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/mapper/centos-root 27G 2.4G 25G 9% / /dev/sda1 1014M 190M 825M 19% /boot
根目录/只有25G,太少了
2.查看磁盘大小
[root@jx-t---02 ~]# fdisk -l Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 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: 0x000b4705 Device Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux /dev/sda2 2099200 62914559 30407680 8e Linux LVM Disk /dev/mapper/centos-root: 29.0 GB, 28982640640 bytes, 56606720 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: 2147 MB, 2147483648 bytes, 4194304 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/sdb: 107.4 GB, 107374182400 bytes, 209715200 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
我们看到/dev/sda和/dev/sdb都有107.4GB,这次我把sdb当作数据盘,存储日志和数据.
3 给磁盘分区
[root@jx-t---02 ~]# fdisk /dev/sdb Welcome to fdisk (util-linux 2.23.2). 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 Building a new DOS disklabel with disk identifier 0xccc31773. Command (m for help):
m可以查看帮助
Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition g create a new empty GPT partition table G create an IRIX (SGI) partition table l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)
我们输入p查看磁盘分区情况
Command (m for help): p Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 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: 0xccc31773 Device Boot Start End Blocks Id System
没有分区,是个新的盘。我们输入n来创建一个新的分区
Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended
让我们选主分区还是扩展分区,这里输入p,创建主分区
后面分别是会让输入分区号、开始扇区、结束扇区,我这里只有一个分区,所以都直接回车,默认值
Partition number (1-4, default 1): 1 First sector (2048-209715199, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199): Using default value 209715199 Partition 1 of type Linux and of size 100 GiB is set
再次输入p,查看分区信息
Command (m for help): p Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 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: 0xccc31773 Device Boot Start End Blocks Id System /dev/sdb1 2048 209715199 104856576 83 Linux
确认无误后按w,保存分区
Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
分区完成之后,开始格式化分区
查看当前系统分区格式
[root@jx-t---02 ~]# mount |grep "^/dev" /dev/mapper/centos-root on / type xfs (rw,relatime,attr2,inode64,noquota) /dev/sda1 on /boot type xfs (rw,relatime,attr2,inode64,noquota)
[root@jx-t---02 ~]# df -hT Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 7.8G 0 7.8G 0% /dev tmpfs tmpfs 7.8G 0 7.8G 0% /dev/shm tmpfs tmpfs 7.8G 65M 7.7G 1% /run tmpfs tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/mapper/centos-root xfs 27G 2.4G 25G 9% / /dev/sda1 xfs 1014M 190M 825M 19% /boot
当前系统使用xfs,我们新的分区也采用这个格式
格式化分区
[root@jx-t---02 ~]# mkfs.xfs /dev/sdb1 meta-data=/dev/sdb1 isize=512 agcount=4, agsize=6553536 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=26214144, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=12799, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0
创建一个目录
[root@jx-t---02 ~]# mkdir /data
在这个目录下,挂载当前分区
[root@jx-t---02 ~]# mount -t xfs /dev/sdb1 /data
查看当前系统分区情况
[root@jx-t---02 ~]# df -HT Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 8.4G 0 8.4G 0% /dev tmpfs tmpfs 8.4G 0 8.4G 0% /dev/shm tmpfs tmpfs 8.4G 68M 8.3G 1% /run tmpfs tmpfs 8.4G 0 8.4G 0% /sys/fs/cgroup /dev/mapper/centos-root xfs 29G 2.6G 27G 9% / /dev/sda1 xfs 1.1G 200M 865M 19% /boot /dev/sdb1 xfs 108G 34M 108G 1% /data
sdb1已经挂载到/data
添加到开机自动挂载 ,/dev/fstab添加最后一行
# # /etc/fstab # Created by anaconda on Wed Jan 8 14:47:11 2020 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=693ec1ef-7824-4d91-824c-999c7f03b93f /xfs defaults0 0 UUID=de0bbc11-8f44-4359-9a7c-de7dbde2a02c /bootxfs defaults0 0 UUID=d0d51829-0200-4294-b0a1-d79e4d8f8086 swapswap defaults0 0 /dev/sdb1/dataxfsdefaults 0 0
4. WCS的日志文件文件目录设置软连接
这次给WCS的3个服务的日志文件夹设置软连接
首先创建文件夹
mkdir /data/log mkdir /data/log/WCS mkdir /data/log/mts_node mkdir /data/log/wcs_gateway
然后停止这3个服务
systemctl stop WCS systemctl stop wcs_gateway systemctl stop mts_node
删除/var/log下对应的3个日志目录
rm -rf /var/log/WCS /var/log/mts_node /var/log/wcs_gateway
创建3个软连接
ln -s /data/log/mts_node /var/log/mts_node ln -s /data/log/wcs_gateway /var/log/wcs_gateway ln -s /data/log/WCS /var/log/WCS
启动3个服务
systemctl start wcs_gateway systemctl start mts_node systemctl start WCS
设置完毕,这样可以不用修改每个服务的配置文件。
查看日志
[root@jx-t---02 ~]# tail -f /var/log/WCS/WCS.log "free_cnt2" : 0, "media_cnt" : 0, "sender_cnt" : 0, "version" : "2.0" }, "request" : "notify", "type" : "MTS statistic" }
参考链接:
https://www.cnblogs.com/still-smile/p/11643722.html
https://blog.csdn.net/weixin_34364071/article/details/89835310