openfiler集群扩展容量

openfiler集群建成之后,通过修改分区实现调整drbd数据卷大小的实验。

drbd0为元数据分区,drbd1为存储数据卷分区。

集群包含名为data的VG, 内含PV:/dev/drbd1 在data中由openfiler创建了filer ftp两个LV。

大小如下:

分区 partition 分区类型 DRBD块设备 容量 扩容
/dev/sda1 ext3 drbd0 600M 不变
/dev/sda2 LVM drbd1 8G 80G

sda这块硬盘是500G的,所以想通过修改sda2分区大小来扩展drbd1

查看当前分区信息
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@filer2 ~]# fdisk /dev/sda

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x1c041c04

Device Boot Start End Blocks Id System
/dev/sda1 2048 1230847 614400 83 Linux
/dev/sda2 1230848 18008063 8388608 8e Linux LVM
记住当前sda2的起始和结束柱面信息

先删除sda2 ,再新建sda2 ,起始柱面必须和之前相同(1230848),结束大于原结束即可。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Command (m for help): d
Partition number (1-4): 2

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4, default 2):
Using default value 2
First sector (1230848-976773167, default 1230848):
Using default value 1230848
Last sector, +sectors or +size{K,M,G} (1230848-976773167, default 976773167): 169002998

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x1c041c04

Device Boot Start End Blocks Id System
/dev/sda1 2048 1230847 614400 83 Linux
/dev/sda2 1230848 169002998 83886075+ 83 Linux

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 8e
Changed system type of partition 2 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x1c041c04

Device Boot Start End Blocks Id System
/dev/sda1 2048 1230847 614400 83 Linux
/dev/sda2 1230848 169002998 83886075+ 8e Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
另一节点扩充同样大小
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
[root@filer1 ~]# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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
Disk identifier: 0x1c041c04

Device Boot Start End Blocks Id System
/dev/sda1 2048 1230847 614400 83 Linux
/dev/sda2 1230848 18008063 8388608 8e Linux LVM

Disk /dev/sdb: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 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
Disk identifier: 0x9f02b0bc

Device Boot Start End Blocks Id System
/dev/sdb1 * 63 1028159 514048+ 83 Linux
/dev/sdb2 1028160 17800019 8385930 83 Linux
/dev/sdb3 17800020 21992984 2096482+ 82 Linux swap / Solaris
[root@filer1 ~]# fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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
Disk identifier: 0x1c041c04

Device Boot Start End Blocks Id System
/dev/sda1 2048 1230847 614400 83 Linux
/dev/sda2 1230848 18008063 8388608 8e Linux LVM

Command (m for help): d
Partition number (1-4): 2

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4, default 2):
Using default value 2
First sector (1230848-976773167, default 1230848):
Using default value 1230848
Last sector, +sectors or +size{K,M,G} (1230848-976773167, default 976773167): 169002998

Command (m for help): p

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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
Disk identifier: 0x1c041c04

Device Boot Start End Blocks Id System
/dev/sda1 2048 1230847 614400 83 Linux
/dev/sda2 1230848 169002998 83886075+ 83 Linux

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 8e
Changed system type of partition 2 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
修改分区之后,需要调整drbd1对应的PV大小。

(在主节点操作)有可能需要在所有节点执行partprobe 并且,主节点会显示磁盘使用中,需要重启将主节点转换成从节点时运行。

根据环境不同,有可能会用到如下的命令。

e2fsck -f /dev/sda2

resize2fs /dev/sda2

drbdadm resize data1

期间注意使用drbd-overview观察drbd连接情况,如果正在同步,则必须等待同步完成后在做如下操作。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@filer2 data]# pvresize -v /dev/drbd1
Using physical volume(s) on command line
Archiving volume group "data" metadata (seqno 6).
Resizing physical volume /dev/drbd1 from 2047 to 20479 extents.
Resizing volume "/dev/drbd1" to 167764904 sectors.
Updating physical volume "/dev/drbd1"
Creating volume group backup "/etc/lvm/backup/data" (seqno 7).
Physical volume "/dev/drbd1" changed
1 physical volume(s) resized / 0 physical volume(s) not resized
[root@filer2 data]# pvs
PV VG Fmt Attr PSize PFree
/dev/drbd1 data lvm2 a- 80.00g 77.65g
[root@filer2 data]# drbd-overview
0:meta Connected Primary/Secondary UpToDate/UpToDate C r----- /meta ext3 591M 24M 537M 5%
1:data1 Connected Primary/Secondary UpToDate/UpToDate C r----- lvm-pv: data 80.00g 2.34g
[root@filer2 data]#

完美扩容。


openfiler集群扩展容量
http://anximin.github.io/2021/08/18/NAS_openfiler_kuozhan/
作者
Sylar
发布于
2021年8月18日
许可协议