Linux系统之创建逻辑卷
生活随笔
收集整理的這篇文章主要介紹了
Linux系统之创建逻辑卷
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Linux系統之創建邏輯卷
- 一、磁盤分區
- 二、創建PV物理卷
- 三、創建卷組,指定PE大小為12M
- 四、創建邏輯卷,大小50個PE
- 五、格式化邏輯卷,并掛載
- 1.格式化邏輯卷
- 2.永久掛載
一、磁盤分區
[root@node1 ~]# fdisk /dev/sdaWelcome to fdisk (util-linux 2.32.1). 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 typep primary (0 primary, 0 extended, 4 free)e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): First sector (2048-41943039, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-41943039, default 41943039): +2GCreated a new partition 1 of type 'Linux' and of size 2 GiB. Partition #1 contains a xfs signature.Do you want to remove the signature? [Y]es/[N]o: YES^H^H^H^H^H^H^H^H^HThe signature will be removed by a write command.Command (m for help): Print P: unknown commandCommand (m for help): printDisk /dev/sda: 20 GiB, 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 Disklabel type: dos Disk identifier: 0x962ab0e1Device Boot Start End Sectors Size Id Type /dev/sda1 2048 4196351 4194304 2G 83 LinuxFilesystem/RAID signature on partition 1 will be wiped.Command (m for help): n Partition typep primary (1 primary, 0 extended, 3 free)e extended (container for logical partitions) Select (default p): p Partition number (2-4, default 2): First sector (4196352-41943039, default 4196352): Last sector, +sectors or +size{K,M,G,T,P} (4196352-41943039, default 41943039): +3GCreated a new partition 2 of type 'Linux' and of size 3 GiB.Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.二、創建PV物理卷
[root@node1 ~]# pvcreate /dev/sda1 /dev/sda2Physical volume "/dev/sda1" successfully created.Physical volume "/dev/sda2" successfully created. [root@node1 ~]#三、創建卷組,指定PE大小為12M
[root@node1 ~]# vgcreate -s 12M vg02 /dev/sda1 /dev/sda2Volume group "vg02" successfully created [root@node1 ~]#四、創建邏輯卷,大小50個PE
[root@node1 ~]# lvcreate -l 50 -n lv02 vg02Logical volume "lv02" created. [root@node1 ~]#五、格式化邏輯卷,并掛載
1.格式化邏輯卷
[root@node1 ~]# mkfs.ext4 /dev/vg02/lv02 mke2fs 1.44.3 (10-July-2018) Creating filesystem with 153600 4k blocks and 38400 inodes Filesystem UUID: f6b201b7-6674-4a31-ba7a-1e97cf2ed35c Superblock backups stored on blocks: 32768, 98304Allocating group tables: done Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done[root@node1 ~]#2.永久掛載
# # /etc/fstab # Created by anaconda on Fri Mar 19 22:21:55 2021 # # 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. # # After editing this file, run 'systemctl daemon-reload' to update systemd # units generated from this file. # UUID=b7190d80-906f-4b9d-9ab4-5a503ecaea2c / xfs defaults 0 0 UUID=525a30a7-d484-4ed5-9f38-f827f54e29ff /boot xfs defaults 0 0 UUID=e6cf8733-5eec-4942-9429-c3e9087b6ff0 swap swap defaults 0 0 UUID="deff8218-3389-4245-a6bf-1716010fd6d4" /mnt/lv01 xfs defaults 0 0 UUID=7b7937af-408b-4370-9bd9-baa0cb5d1c6b swap swap defaults 0 0 UUID="c4477c1b-5ce7-4257-a44f-5e43e1d2a18e" /mnt/vdb3 xfs defaults 0 0 UUID="f6b201b7-6674-4a31-ba7a-1e97cf2ed35c" /mnt/lv02 ext4 defaults 0 0 [root@node1 ~]# mount -a [root@node1 ~]# df -h /dev/vg02/lv02 Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg02-lv02 575M 912K 532M 1% /mnt/lv02 [root@node1 ~]#總結
以上是生活随笔為你收集整理的Linux系统之创建逻辑卷的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux下的文件系统修复
- 下一篇: Linux下的find的使用方法