[root@SERVER2 dev]# fdisk /dev/sdb Device contains
neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only, until
you decide to write them. After that, of course, the previous content
won't be recoverable.
The number of cylinders for this disk is
set to 145684. 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) Warning: invalid flag 0x0000 of partition table 4 will be
corrected by w(rite)
Command (m for help): p
Disk
/dev/sdb: 1198.2 GB, 1198295875584 bytes 255 heads, 63 sectors/track,
145684 cylinders Units = cylinders of 16065 * 512 = 8225280
bytes
Device Boot Start End Blocks Id
System
建立物理卷PV:
[root@SERVER2 dev]# pvcreate /dev/sdb Physical volume
"/dev/sdb" successfully created
创建VG卷组:
[root@SERVER2 dev]# vgscan Reading all physical volumes.
This may take a while...#一般我们初始建立卷组时都要先scan下. Found volume group "soleil"
using metadata type lvm2 Found volume group "VolGroup00" using metadata
type lvm2
[root@SERVER2 dev]# vgdisplay soleil --- Volume
group --- VG Name soleil System ID
Format lvm2 Metadata Areas 1
Metadata Sequence No 26 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 1.09 TB PE
Size 4.00 MB Total PE 285695 Alloc
PE / Size 285695 / 1.09 TB Free PE / Size 0 / 0
VG UUID
iEGRp4-yLeD-Thkj-4YRA-o0HP-82KY-W2YgTS
下面是建立逻辑卷:
[root@localhost /]# lvcreate -n data -L 1.9TBM vg0
#建立名为data,大小1.9TB /dev/cdrom: open failed: Read-only file
system Rounding up size to full physical extent 1.92TB Logical
volume "data" created [root@SERVER2 dev]# lvdisplay --- Logical
volume --- LV Name /dev/soleil/data VG
Name soleil LV UUID
swZafx-tezV-rsMf-wdEb-vlb6-Ko8z-0gUTLU LV Write Access
read/write LV Status available #
open 1 LV Size 1.09 TB Current
LE 285695 Segments 1
Allocation inherit Read ahead sectors 0 Block
device 253:2
--- Logical volume --- LV
Name /dev/VolGroup00/LogVol00 VG Name
VolGroup00 LV UUID
Hnct0R-vp1y-tZPl-VMXU-AZ2C-Y6ru-umo4m0 LV Write Access
read/write LV Status available #
open 1 LV Size 134.59 GB
Current LE 4307 Segments 1
Allocation inherit Read ahead sectors 0 Block
device 253:0
--- Logical volume --- LV
Name /dev/VolGroup00/LogVol01 VG Name
VolGroup00 LV UUID
VZuwuR-JFcA-MDM8-5OGM-yNVe-AXrK-1T1f23 LV Write Access
read/write LV Status available #
open 1 LV Size 1.94 GB Current
LE 62 Segments 1
Allocation inherit Read ahead sectors 0 Block
device 253:1 [root@SERVER2 dev]# mkfs.ext3 /dev/vg0/data
#格式化成ext3格式. mke2fs 1.35 (28-Feb-2008) Filesystem label= OS
type: Linux Block size=1024 (log=0) Fragment size=1024
(log=0) 3072 inodes, 12288 blocks 614 blocks (5.00%) reserved for
the super user First data block=1 Maximum filesystem
blocks=12582912 2 block groups 8192 blocks per group, 8192
fragments per group 1536 inodes per group Superblock backups
stored on blocks: 8193 Writing inode tables: done
Creating journal (1024 blocks): done Writing superblocks and filesystem
accounting information: done This filesystem will be automatically
checked every 35 mounts or 180 days, whichever comes first. Use tune2fs
-c or -i to override. [root@SERVER2 dev]# mount /dev/vg0/data /mnt/
#mount到/mnt文件夹 [root@SERVER2 dev]# cp /etc/hosts /mnt/ #拷贝个文件进去试下
[root@SERVER2 dev]# ls /mnt/ #看下,里面已经有个hosts文件了. lost+found
hosts
[root@SERVER2 dev]#umount /mnt/ [root@SERVER2 dev]#
lvextend -L +10M /dev/vg0/data #扩展逻辑卷大小 /dev/cdrom: open failed:
Read-only file system Rounding up size to full physical extent 12.00
MB Extending logical volume data to 1.930TB Logical volume
data successfully resized