在CentOS系统中,进行分卷操作时,可以使用以下几种常用工具:
fdisk:
fdisk /dev/sdb
# 对/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.
Command (m for help):
n # 建立一个新分区
Partition type: p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-41943039, default 2048): Using default value 2048
Last sector, sectors or size{K,M,G} (2048-41943039, default 41943039): 2G
Partition 1 of type Linux and of size 2 GiB is set
Command (m for help):
t # 指定分区标记类型
Selected partition 1
Hex code (type L to list all codes): 82
Changed type of partition 'Linux' to 'Linux swap / Solaris'
Command (m for help):
w # 保存操作
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
parted:
parted /dev/sdb mklabel gpt
# 指定磁盘模式为GPT
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost.
Do you want to continue? Yes/No? yes
Information: You may need to update /etc/fstab.
parted /dev/sdb print
# 显示磁盘信息
LVM(逻辑卷管理):
vgdisplay
lvreduce -L -10G -n centos /dev/mapper/centos-root
lvcreate -L 10G --name cinder-volumes /dev/mapper/centos-root
mkfs.ext4 /dev/centos/cinder-volumes
mount /dev/centos/cinder-volumes /mymount/
tar:
tar zcf - /www/wwwroot | split -d -b 999m - wwwroot.tar.gz.
# 分卷压缩gz
split:
split -b 100M filename.tar.gz splitfile.
# 将filename.tar.gz分割成每个100MB的小文件
这些工具可以满足在CentOS系统中进行分卷操作的基本需求,用户可以根据具体情况进行选择和使用。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>