磁盘管理

参考资料

http://qicheng0211.blog.51cto.com/3958621/1620171

一、添加一块8G硬盘。先关机,选择SATA,底下一切默认。

二、设置

1.查看硬盘名

#fdisk -l

2.对新盘分区

#fdisk /dev/sdb
依次按下p、n、p、1、两下回车、t、L、8e、p、w

3.确认

#partprobe

4.创建物理卷

[root@xue ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created
#pvdisplay

5.将PV加入卷组(VG)

#vgdisplay
[root@xue ~]# vgextend centos /dev/sdb1
  Volume group "centos" successfully extended

6.创建逻辑卷(LV)

[root@xue ~]# lvcreate -L 4G -n newlv centos
  Logical volume "newlv" created.
#lvdisplay

7.格式化逻辑卷并挂载

[root@xue ~]# mkfs.xfs /dev/centos/newlv
meta-data=/dev/centos/newlv      isize=256    agcount=4, agsize=262144 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=1048576, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@xue ~]# mount -t xfs /dev/centos/newlv /mnt
[root@xue ~]# df -Th
Filesystem               Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  xfs       6.7G  5.6G  1.1G  84% /
devtmpfs                 devtmpfs  487M     0  487M   0% /dev
tmpfs                    tmpfs     497M     0  497M   0% /dev/shm
tmpfs                    tmpfs     497M  6.6M  490M   2% /run
tmpfs                    tmpfs     497M     0  497M   0% /sys/fs/cgroup
/dev/sda1                xfs       497M  124M  374M  25% /boot
tmpfs                    tmpfs     100M     0  100M   0% /run/user/0
/dev/mapper/centos-newlv xfs       4.0G   33M  4.0G   1% /mnt

8.设置开机自动挂载

#vi /etc/fstab
在最后一行加入:
/dev/cetos/newly        /mnt                    xfs     defaults        1 2

9.逻辑卷扩容

[root@xue ~]# lvextend -l +100%FREE /dev/centos/newlv
  Size of logical volume centos/newlv changed from 4.00 GiB (1024 extents) to 8.04 GiB (2057 extents).
  Logical volume newlv successfully resized.
[root@xue ~]# lvextend -l +100%FREE /dev/centos/newlv
[root@xue ~]# df -Th

你可能感兴趣的:(磁盘管理)