參考資料:
linux服務器掛載FC-SAN(大於8TB)
用指令:
pvdisplay
vgdisplay
lvdisplay
parted
(parted) select /dev/sda
lvextend -L 850G /dev/ubuntu-vg/ubuntu-lv
resize2fs /dev/ubuntu-vg/ubuntu-lv
以下是客戶端新增動作
root@UBUNTU:~# parted
GNU Parted 3.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) select /dev/sdb
Using /dev/sdb
(parted) resizepart
Partition number? 3
End? [960GB]? 222
Error: Can't have the end before the start! (start sector=4198400 length=-3764806)
(parted) p
Model: AVAGO SMC3108 (scsi)
Disk /dev/sdb: 960GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 2097kB 1049kB bios_grub
2 2097kB 2150MB 2147MB ext4
3 2150MB 960GB 958GB
(parted) quit
root@UBUNTU:~# pvdisplay
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
--- Physical volume ---
PV Name /dev/sdb3
VG Name ubuntu-vg
PV Size <891.75 GiB / not usable 0
Allocatable yes
PE Size 4.00 MiB
Total PE 228287
Free PE 202687
Allocated PE 25600
PV UUID VC53-qT4R-g43Shs
root@UBUNTU:~# vgdisplay
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
--- Volume group ---
VG Name ubuntu-vg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size <891.75 GiB
PE Size 4.00 MiB
Total PE 228287
Alloc PE / Size 25600 / 100.00 GiB
Free PE / Size 202687 / <791.75 GiB
VG UUID xW-LXf1-4UFSNi
root@UBUNTU:~# lvdisplay
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
--- Logical volume ---
LV Path /dev/ubuntu-vg/ubuntu-lv
LV Name ubuntu-lv
VG Name ubuntu-vg
LV UUID l4-tZhI-WmUTLg
LV Write Access read/write
LV Creation host, time ubuntu-server, 2022-06-23 11:28:18 +0800
LV Status available
# open 1
LV Size 100.00 GiB
Current LE 25600
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
root@UBUNTU:~# ^C
root@UBUNTU:~# lvextend -L 850G /dev/ubuntu-vg/ubuntu-lv
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
Size of logical volume ubuntu-vg/ubuntu-lv changed from 100.00 GiB (25600 extents) to 850.00 GiB (217600 extents).
Logical volume ubuntu-vg/ubuntu-lv successfully resized.
root@UBUNTU:~# lvdisplay
/dev/sda: open failed: No medium found
/dev/sda: open failed: No medium found
--- Logical volume ---
LV Path /dev/ubuntu-vg/ubuntu-lv
LV Name ubuntu-lv
VG Name ubuntu-vg
LV UUID Oel4-tZhI-WmUTLg
LV Write Access read/write
LV Creation host, time ubuntu-server, 2022-06-23 11:28:18 +0800
LV Status available
# open 1
LV Size 850.00 GiB
Current LE 217600
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
root@UBUNTU:~# resize2fs /dev/ubuntu-vg/ubuntu-lv
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/ubuntu-vg/ubuntu-lv is mounted on /; on-line resizing required
old_desc_blocks = 13, new_desc_blocks = 107
The filesystem on /dev/ubuntu-vg/ubuntu-lv is now 222822400 (4k) blocks long.
root@UBUNTU:~#
結論:
pvdisplay 看是891G
vgdisplay 看也是891G
lvdisplay 看是100G
代表lv可以直接延伸所以下lvextend -L 850G /dev/ubuntu-vg/ubuntu-lv
延伸到850G
resize2fs /dev/ubuntu-vg/ubuntu-lv 下這個指令立即生效
補充資料: 怕原本網址無法連結>這邊再貼一次
parted #大於2T分區需要用parted命令進去配置
- (parted) mklabel
- New disk label type? gpt
- (parted) print
- Model: Promise 14 Disk RAID5 (scsi)
- Disk /dev/sdb: 12.9TB
- Sector size (logical/physical): 512B/512B
- Partition Table: gpt
(parted) mklabel GPT 也行
(parted) ext3/4 #redhat5.4只支持3 但是加-F參數能不改塊大小支持到16TB 5.6以上版本支持到ext4,有條件還是用ext4
起始點(parted) 0 結束點 根據實際情況 計算單位B p #查看分區情況
quit 退出 /rm+ID 移除
--------------------------------------
4. mkfs.ext3 -F /dev/sdb1 #格式化分區,ext3如果不指定block size的大小爲8K最大隻能支持到8TB,優選用ext4
mount /dev/sdb1 /FCsan #掛載
mount #檢查掛載
/etc/fstab # vi /etc/fstab #修改配置 手動mount避免失效
格式如下:
/dev/sdb1(磁盤分區) /home(mount目錄) ext3(文件式式) defaults 0 0