一、删除原来挂载好的云盘和分区
1、查看挂载号的云盘
fdisk -l
发现我们有5千多G但是只挂载了2T,心里非常的慌张!十分的不爽!
好,我们把它干掉,重新分区!
2、解除挂载
umount /homeE
没保存跳转到(7),发现报错
3、查看被挂载的文件被调用情况
fuser -mv /homeE
没报错跳转到(5),发现报错
4、下载依赖
yum install -y psmisc
可能会有点慢,等几分钟。
安装完成!
5、再来查看被挂载的文件被调用情况
fuser -mv /homeE
强制删除调用进程!
kill -9 12828
查询到被调用的全部进程都要删掉!
6、再来解除挂载
umount /homeE
没有提示。
7、删除分区
fdisk /dev/vdd
[root@ecs-87a2-0202396 /]# fdisk /dev/vdd
WARNING: The size of this disk is 5.5 TB (5497558138880 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
partition table format (GPT).
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): p
Disk /dev/vdd: 5497.6 GB, 5497558138880 bytes, 10737418240 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: 0x46a55452
Device Boot Start End Blocks Id System
/dev/vdd1 2048 4294967294 2147482623+ 83 Linux
# 删除分区
Command (m for help): d
Selected partition 1
Partition 1 is deleted
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
# 退出
Command (m for help): quit
大功告成!
二、使用parted挂载(超过2T)云盘
1、查看我们的云盘地址
fdisk -l
可以看到我们云盘的地址是:/dev/vdd
2、挂载云盘
# 进入parted模式
[root@ecs-87a2-0202396 /]# parted /dev/vdd
GNU Parted 3.1
Using /dev/vdd
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: Virtio Block Device (virtblk)
Disk /dev/vdd: 5498GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
# 超过2T的必须使用gpt模式分区
(parted) mklabel gpt
Warning: The existing disk label on /dev/vdd will be destroyed and all data on this disk will be lost.
Do you want to continue?
# 是否格式化原来的数据
Yes/No? y
# 开始分区
(parted) mkpart
# 分区名称
Partition name? []? vdd1
# 文件格式,超过2T的盘最好是ext4
File system type? [ext2]? ext4
# 开始大小
Start? 0
# 结束大小,直接复制上面查看到的
End? 5498GB
Warning: The resulting partition is not properly aligned for best performance.
# 选择Ignore
Ignore/Cancel? Ignore
#完成分区,查看分区情况
(parted) p
Model: Virtio Block Device (virtblk)
Disk /dev/vdd: 5498GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 17.4kB 5498GB 5498GB vdd1
#退出
(parted) quit
Information: You may need to update /etc/fstab.
[root@ecs-87a2-0202396 /]#
3、挂载文件
#创建文件
mkdir home
#挂载
mount /dev/vdd1 /home
4、查看成功
cd /home
df -h ./
完美!
5、设置开机自动分配
vi /etc/fstab
#######################
.......
/dev/vdd1 /home ext4 defaults 0 0