SUSE Linux+存儲陣列目前是主流應用,根據自己的工程經驗,以下總結下suse 服務器下如何使用LVM管理軟件進行陣列配置。
在SUSE服務器對陣列進行配置一般有兩種模式:
1,直接使用fdisk +外掛存儲設備名,對其進行分區劃分。使用fdisk劃分出來的分區最大為2T,適合陣列容量不是太大情況下使用;
2,使用LVM管理軟件:
LVM是邏輯盤卷管理的簡稱(logic volume manager),它是liunx下對磁盤分區進行管理一種機制。LVM是建立在硬盤和分區之間的邏輯層,可以提高磁盤分區管理的靈活性。管理員通過LVM可以輕松管理磁盤分區,是目前linux下使用最廣泛的工具。
LVM可以使用PV,LV,VG等命令來進行大容量陣列分區,管理方便,並且擴容陣列方便,增加了系統的擴展性,所以優先考慮。
以下是在實際開局工程中LVM下配置陣列全步驟:
1,執行fdisk –l命令檢查服務器是否正確識別到了存儲設備,一般存儲的容量會遠大於本地硬盤的容量。
cspfstest:~ # fdisk -l
Disk /dev/sda: 146.6 GB, 146693685248 bytes
255 heads, 63 sectors/track, 17834 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 1045 8393931 82 Linux swap / Solaris
/dev/sda2 * 1046 11489 83891430 83 Linux
/dev/sda3 11490 17834 50966212+ f W95 Ext'd (LBA)
/dev/sda5 11490 16711 41945683+ 83 Linux
Disk /dev/sdb: 1799.5 GB, 1799589199872 bytes
255 heads, 63 sectors/track, 218787 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
此處/dev/sdb就是外掛的存儲陣列
2,創建物理硬盤分區
a,創建分區
cspfstest:~ # fdisk /dev/sdb
The number of cylinders for this disk is set to 218787.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
b,輸入n 創建新分區
c,輸入P創建主分區
Command (m for help): n Command action
e extended
p primary partition (1-4)
Partition number (1-4): 1
First cylinder (1-218787, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-218787, default 218787): +1000000M
--此處創建了一個1T的分區
d,在“Command (m for help)”提示行下輸入t修改分區類型,修改為LVM分區,創建完成後輸入w保存
Command (m for help): p
Disk /dev/sdb: 1799.5 GB, 1799589199872 bytes
255 heads, 63 sectors/track, 218787 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 121577 976567221 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
3,創建PV、VG和LV
a,創建PV:
cspfstest:~ # pvcreate /dev/sdb1
PV成功創建標志:
Physical volume "/dev/sdb1" successfully created
創建完成可以使用pvdisplay進行查看
b,創建VG:
cspfstest:~ # vgcreate vgfs /dev/sdb1 /dev/sdb2 -s 128M
VG成功創建標志:
Volume group "vgfs" successfully created
創建完成可以使用vgdisplay進行查看
c,創建LV:
cspfstest:~ # lvcreate -l 65000 -n lvfs1 vgfs
LV成功創建標志:
lvcreate -l 65000 -n lvfs2 vgfs Insufficient free extents (13407) in volume group vgfs: 65000 required
4,創建ext3的文件系統
在LV上進行文件系統創建:
cspfstest:/dev/mapper # mkfs.ext3 /dev/mapper/vgfs-lvfs2
文件系統開始創建:
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
106496000 inodes, 212992000 blocks
10649600 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
6500 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done