1.卸载分区
[root@centos7 ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 17G 4.0G 14G 24% /
devtmpfs devtmpfs 974M 0 974M 0% /dev
tmpfs tmpfs 991M 0 991M 0% /dev/shm
tmpfs tmpfs 991M 11M 981M 2% /run
tmpfs tmpfs 991M 0 991M 0% /sys/fs/cgroup
/dev/sdb1 xfs 8.0G 33M 8.0G 1% /mnt/sdb1
/dev/sdb2 xfs 12G 33M 12G 1% /mnt/sdb2
/dev/sda1 xfs 1014M 166M 849M 17% /boot
tmpfs tmpfs 199M 8.0K 199M 1% /run/user/42
tmpfs tmpfs 199M 0 199M 0% /run/user/0
[root@centos7 ~]# umount /dev/sdb1
[root@centos7 ~]# umount /dev/sdb2
将fstab文件最后两行关于/dev/sdb1和/dev/sdb2的内容删除
[root@centos7 ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Tue Aug 13 23:27:51 2019
#
# 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
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=18170546-e5ce-4fd1-9f7a-45df40e45621 /boot xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
/dev/sdb1 /mnt/sdb1 xfs defaults 0 0
/dev/sdb2 /mnt/sdb2 xfs defaults,usrquota,grpquota 0 0
[root@centos7 ~]# vi /etc/fstab
[root@centos7 ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Tue Aug 13 23:27:51 2019
#
# 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
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=18170546-e5ce-4fd1-9f7a-45df40e45621 /boot xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
2.删除分区
[root@centos7 ~]# 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.
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)
Command (m for help): d
Partition number (1,2, default 2):
Partition 2 is deleted
Command (m for help): d
Selected partition 1
Partition 1 is deleted
Command (m for help): p
Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 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: 0x302fa02d
Device Boot Start End Blocks Id System
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)