linux pv vg lv 的创建

[root@localhost ~]# pvcreate /dev/sdc3     ------------创建PV+分区路径
  Physical volume "/dev/sdc3" successfully created.
[root@localhost ~]# vgcreate -s 48m vg2 /dev/sdc3 -------创建vg + 容量+VG名称+ 分区路径
  Volume group "vg2" successfully created
[root@localhost ~]# lvcreate -L 1g -n lv2 /dev/vg2    ----------创建lv+容量+lv名称+所使用的vg名称
  Rounding up size to full physical extent 1.03 GiB
  Logical volume "lv2" created.
[root@localhost ~]# lvs   ----------查看创建后的lv信息
  LV   VG   Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  app  rhel -wi-ao---- <1.80g                                                    
  root rhel -wi-ao---- 12.00g                                                    
  swap rhel -wi-ao----  6.00g                                                    
  lv1  vg1  -wi-ao----  1.00g                                                    
  lv2  vg2  -wi-a-----  1.03g         --------此为最新创建的                                            
[root@localhost ~]# mkfs.ext4 /dev/vg2/lv2    -------格式化lv 
mke2fs 1.44.3 (10-July-2018)
Creating filesystem with 270336 4k blocks and 67680 inodes
Filesystem UUID: e4a7b4ad-8d12-4eea-a431-bc505a9fae1a
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

[root@localhost ~]# mkdir /app/lv2    --------创建挂载目录
mkdir: cannot create directory ‘/app/lv2’: File exists
[root@localhost ~]# mount /dev/vg2/lv2 /app/lv2  --------挂载新lv到挂载点
[root@localhost ~]# df -Th  -------查看详细的挂载信息   带文件type
Filesystem            Type      Size  Used Avail Use% Mounted on
devtmpfs              devtmpfs  888M     0  888M   0% /dev
tmpfs                 tmpfs     904M     0  904M   0% /dev/shm
tmpfs                 tmpfs     904M  9.8M  894M   2% /run
tmpfs                 tmpfs     904M     0  904M   0% /sys/fs/cgroup
/dev/mapper/rhel-root xfs        12G  3.9G  8.2G  32% /
/dev/mapper/rhel-app  xfs       1.8G   46M  1.8G   3% /app
/dev/sda1             ext4      190M  131M   45M  75% /boot
tmpfs                 tmpfs     181M   16K  181M   1% /run/user/42
tmpfs                 tmpfs     181M  3.5M  178M   2% /run/user/0
/dev/sr0              iso9660   6.7G  6.7G     0 100% /run/media/root/RHEL-8-0-0-BaseOS-x86_64
/dev/mapper/vg1-lv1   ext4      976M  2.6M  907M   1% /app/lv1
/dev/mapper/vg2-lv2   ext4     1008M  2.6M  936M   1% /app/lv2
[root@localhost ~]# dd if=/dev/zero of=/app/lv2/testfile bs=10 count=10    --------查看文件系统是否有效
10+0 records in
10+0 records out
100 bytes copied, 0.000185469 s, 539 kB/s
 

猜你喜欢

转载自blog.csdn.net/weixin_45448980/article/details/114368813
今日推荐