linux 扩展文件系统

1. 创建新分区

[root@localhost ~]# fdisk -l

Disk /dev/sda: 32.2 GB,  bytes,  sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk label type: dos
Disk identifier: 0x000a8293 Device Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 8e Linux LVM Disk /dev/mapper/cl-root: MB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes Disk /dev/mapper/cl-swap: MB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes [root@localhost ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.). 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 ( primary, extended, free)
e extended
Select (default p): p
Partition number (,, default ):
First sector (-, default ):
Using default value
Last sector, +sectors or +size{K,M,G} (-, default ): +2G
Partition of type Linux and of size GiB is set Command (m for help): p Disk /dev/sda: 32.2 GB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk label type: dos
Disk identifier: 0x000a8293 Device Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 8e Linux LVM
/dev/sda3 Linux Command (m for help): t   # 修改文件系统类型
Partition number (-, default ):
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM' Command (m for help): p Disk /dev/sda: 32.2 GB, bytes, sectors
Units = sectors of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk label type: dos
Disk identifier: 0x000a8293 Device Boot Start End Blocks Id System
/dev/sda1 * Linux
/dev/sda2 8e Linux LVM
/dev/sda3 8e Linux LVM Command (m for help): w
The partition table has been altered!

2. partprobe

[root@localhost named]# partprobe

3. 创建 pv

[root@localhost ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created.
[root@localhost ~]# pvdisplay   
--- Physical volume ---
PV Name /dev/sda2
VG Name cl
PV Size 9.80 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE
Free PE
Allocated PE
PV UUID vBCY0m-syaR-HKNJ-FNlW-G7Ql-2eru-4ccPC6 "/dev/sda3" is a new physical volume of "2.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sda3
VG Name
PV Size 2.00 GiB
Allocatable NO
PE Size
Total PE
Free PE
Allocated PE
PV UUID kRvof2-gzMz-raeu-njD7-vujG-N45B-yJemBd

4. 将 pv 添加到 vg

[root@localhost ~]# vgextend cl /dev/sda3
Volume group "cl" successfully extended
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
cl wz--n- .80g .00g
[root@localhost ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 cl lvm2 a-- .80g
/dev/sda3 cl lvm2 a-- .00g .00g

5. 扩展 lv

[root@localhost ~]# lvextend /dev/cl/root /dev/sda3
Size of logical volume cl/root changed from 7.80 GiB ( extents) to 9.80 GiB ( extents).
Logical volume cl/root successfully resized.

6. 扩展文件系统的逻辑边界

[root@localhost ~]# xfs_growfs /dev/cl/root
meta-data=/dev/mapper/cl-root isize= agcount=, agsize= blks
= sectsz= attr=, projid32bit=
= crc= finobt= spinodes=
data = bsize= blocks=, imaxpct=
= sunit= swidth= blks
naming =version bsize= ascii-ci= ftype=
log =internal bsize= blocks=, version=
= sectsz= sunit= blks, lazy-count=
realtime =none extsz= blocks=, rtextents=
data blocks changed from to
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/cl-root .8G 1021M .8G % /
devtmpfs .9G .9G % /dev
tmpfs .9G .9G % /dev/shm
tmpfs .9G 8.6M .9G % /run
tmpfs .9G .9G % /sys/fs/cgroup
/dev/sda1 197M 117M 81M % /boot
tmpfs 378M 378M % /run/user/
[root@localhost ~]#
上一篇:js 鼠标放到图片上放大某一部分效果


下一篇:.NET Core的文件系统[5]:扩展文件系统构建一个简易版“云盘”