[root@host-10-1-234-164 puaiuc]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 410K 0 rom
vda 252:0 0 40G 0 disk
├─vda1 252:1 0 1G 0 part /boot
└─vda2 252:2 0 39G 0 part
├─centos-root 253:0 0 35.1G 0 lvm /
└─centos-swap 253:1 0 3.9G 0 lvm [SWAP]
vdb 252:16 0 100G 0 disk
└─vdb1 252:17 0 30G 0 part
##################################################################################
删除分区:
[root@host-10-1-234-164 puaiuc]# fdisk /dev/vdb
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
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.
##################################################################################
创建60G分区
[root@host-10-1-234-164 puaiuc]# fdisk /dev/vdb
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): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p^H
Partition number (1-4, default 1):
First sector (2048-209715199, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199): +60G
Partition 1 of type Linux and of size 60 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
######################################################################
创建第二个分区
[root@host-10-1-234-164 puaiuc]# fdisk /dev/vdb
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 (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (2-4, default 2):
First sector (125831168-209715199, default 125831168):
Using default value 125831168
Last sector, +sectors or +size{K,M,G} (125831168-209715199, default 209715199): +39G
Partition 2 of type Linux and of size 39 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@host-10-1-234-164 puaiuc]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 410K 0 rom
vda 252:0 0 40G 0 disk
├─vda1 252:1 0 1G 0 part /boot
└─vda2 252:2 0 39G 0 part
├─centos-root 253:0 0 35.1G 0 lvm /
└─centos-swap 253:1 0 3.9G 0 lvm [SWAP]
vdb 252:16 0 100G 0 disk
├─vdb1 252:17 0 60G 0 part
└─vdb2 252:18 0 39G 0 part
####################################################################
格式化分区
[root@host-10-1-234-164 puaiuc]# mkfs.xfs /dev/vdb1 -f
meta-data=/dev/vdb1 isize=512 agcount=4, agsize=3932160 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=15728640, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=7680, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
#########################################################################
写分区表
echo "/dev/vdb1 /data xfs defaults 0 0" >> /etc/fstab
#########################################################################
手动查看
[root@host-10-1-234-164 puaiuc]# mkdir /data
[root@host-10-1-234-164 puaiuc]# mount /dev/vdb1 /data
[root@host-10-1-234-164 puaiuc]# ls /data
[root@host-10-1-234-164 puaiuc]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 36G 1.6G 34G 5% /
devtmpfs 7.9G 0 7.9G 0% /dev
tmpfs 7.9G 0 7.9G 0% /dev/shm
tmpfs 7.9G 8.4M 7.9G 1% /run
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
/dev/vda1 1014M 127M 888M 13% /boot
tmpfs 1.6G 0 1.6G 0% /run/user/1000
/dev/vdb1 60G 33M 60G 1% /data
#########################################################################
[root@host-10-1-234-164 puaiuc]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 410K 0 rom
vda 252:0 0 40G 0 disk
├─vda1 252:1 0 1G 0 part /boot
└─vda2 252:2 0 39G 0 part
├─centos-root 253:0 0 35.1G 0 lvm /
└─centos-swap 253:1 0 3.9G 0 lvm [SWAP]
vdb 252:16 0 100G 0 disk
├─vdb1 252:17 0 60G 0 part
└─vdb2 252:18 0 39G 0 part
#############################################################
如果卷被占用,无法删除,则需要强制删除不用vg
dmsetup remove vg_94295d9ca438cfbc2caffc074e61cfdf-tp_7cef6c9ae149a4e0af2f65fbf3f1f16e_tdata
################################################################
允许root登录ssh
sed -i 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config
网友评论