本帖最后由 宏源x 于 2024-11-7 14:30 编辑
应该适用于某辉的存储直接挂载
前提。先分区,分区了以后不要格式化 如/dev/sdb2
第一步,创建PV
- root@fnos:~# pvremove /dev/sda2
- Labels on physical volume "/dev/sda2" successfully wiped.
- root@fnos:~# pvcreate /dev/md128 /dev/sda2
- No device found for /dev/md128.
- Physical volume "/dev/sda2" successfully created.
复制代码 第二步,创建VG,记住VG的命名规范(名称按照trim_XXXXX,如果不会可以直接照抄这个trim_129ad5d9_9300_440e_a6e1_708c139100da),或者仅改后面的几个字符就行了
- root@fnos:~# vgcreate trim_129ad5d9_9300_440e_a6e1_708c139100da /dev/sda2
- Volume group "trim_129ad5d9_9300_440e_a6e1_708c139100da" successfully created
复制代码 第三步。查看vgdisplay
- --- Volume group ---
- VG Name trim_129ad5d9_9300_440e_a6e1_708c139100da
- System ID
- Format lvm2
- Metadata Areas 1
- Metadata Sequence No 1
- VG Access read/write
- VG Status resizable
- MAX LV 0
- Cur LV 0
- Open LV 0
- Max PV 0
- Cur PV 1
- Act PV 1
- VG Size 465.63 GiB
- PE Size 4.00 MiB
- Total PE 119202
- Alloc PE / Size 0 / 0
- Free PE / Size 119202 / 465.63 GiB
- VG UUID 3PfduE-ZH7A-k9VH-INvx-X2fN-X1if-aWn6sB
复制代码 记下Total PE 119202这个数值,下面用
第四步,创建LV,名称都是0,(119202是VG中Total PE的个数)
- root@fnos:~# lvcreate -l 119202 -n 0 trim_129ad5d9_9300_440e_a6e1_708c139100da
- WARNING: btrfs signature detected on /dev/trim_129ad5d9_9300_440e_a6e1_708c139100da/0 at offset 65600. Wipe it? [y/n]: y
- Wiping btrfs signature on /dev/trim_129ad5d9_9300_440e_a6e1_708c139100da/0.
- Logical volume "0" created.
复制代码 第五步,格式化LV成btrfs格式
- root@fnos:~# mkfs.btrfs /dev/trim_129ad5d9_9300_440e_a6e1_708c139100da/0
- btrfs-progs v6.2
- See http://btrfs.wiki.kernel.org for more information.
- NOTE: several default settings have changed in version 5.15, please make sure
- this does not affect your deployments:
- - DUP for metadata (-m dup)
- - enabled no-holes (-O no-holes)
- - enabled free-space-tree (-R free-space-tree)
- Label: (null)
- UUID: 096b8e72-fcb3-4c83-a1c5-acb9c452dd00
- Node size: 16384
- Sector size: 4096
- Filesystem size: 465.63GiB
- Block group profiles:
- Data: single 8.00MiB
- Metadata: DUP 1.00GiB
- System: DUP 8.00MiB
- SSD detected: no
- Zoned device: no
- Incompat features: extref, skinny-metadata, no-holes
- Runtime features: free-space-tree
- Checksum: crc32c
- Number of devices: 1
- Devices:
- ID SIZE PATH
- 1 465.63GiB /dev/trim_129ad5d9_9300_440e_a6e1_708c139100da/0
复制代码 然后就可以在飞牛的存储空间管理界面挂载啦。
最后看一下,那个/dev/md127是系统创建的raid basic模式,/dev/sda2是我手动创建的就linear
- root@fnos:~# pvs
- PV VG Fmt Attr PSize PFree
- /dev/md127 trim_23bfc027_894b_4b14_9c27_a1f7c489b18e lvm2 a-- <78.18g 0
- /dev/sda2 trim_129ad5d9_9300_440e_a6e1_708c139100da lvm2 a-- 465.63g 0
- root@fnos:~# vgs
- VG #PV #LV #SN Attr VSize VFree
- trim_129ad5d9_9300_440e_a6e1_708c139100da 1 1 0 wz--n- 465.63g 0
- trim_23bfc027_894b_4b14_9c27_a1f7c489b18e 1 1 0 wz--n- <78.18g 0
- root@fnos:~# lvs
- LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
- 0 trim_129ad5d9_9300_440e_a6e1_708c139100da -wi-ao---- 465.63g
- 0 trim_23bfc027_894b_4b14_9c27_a1f7c489b18e -wi-ao---- <78.18g
复制代码
如果本来某辉的存储空间盘,改个VG和LV名称规范应该就能识别挂载了。
修改LV名称是lvrename /dev/按Tab键补齐原LV名称,原LV是2,改成LV为0,应该这样
- lvrename /dev/vg2-volume/2 /dev/vg2-volume/0
复制代码 修改VG名称输入vgrename 空格按Tab键自动补齐VG名称,应该这样
- vgrename vg2-volume trim_129ad5d9_9300_440e_a6e1_708c139100da
复制代码 其中,原VG名称vg2-volume,改成trim_129ad5d9_9300_440e_a6e1_708c139100da名称。
|