Centos7扩展磁盘空间(LVM管理)
1. 查看磁盘情况
fdisk -l /dev/sda
Disk /dev/sda: 536.9 GB, 536870912000 bytes, 1048576000 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk label type: dos Disk identifier: 0x000ac88a Device Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux /dev/sda2 2099200 266338303 132119552 8e Linux LVM
2. 查看磁盘占用情况
df -lh
Filesystem Size Used Avail Use% Mounted on /dev/mapper/cl-root 50G 24G 27G 47% / devtmpfs 5.8G 0 5.8G 0% /dev tmpfs 5.8G 84K 5.8G 1% /dev/shm tmpfs 5.8G 8.8M 5.8G 1% /run tmpfs 5.8G 0 5.8G 0% /sys/fs/cgroup /dev/sda1 1014M 173M 842M 18% /boot /dev/mapper/cl-home 69G 517M 68G 1% /home tmpfs 1.2G 16K 1.2G 1% /run/user/42 tmpfs 1.2G 0 1.2G 0% /run/user/0
3. 创建新分区
fdisk /dev/sda
弹出的命令行中输入对应的命令,命令说明如下:
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)
a) 命令行输入 n 创建新分区
[root@lenmom ~]# fdisk /dev/sda The device presents a logical sector size that is smaller than the physical sector size. Aligning to a physical sector (or optimal I/O) size boundary is recommended, or performance may be impacted. Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you de