30 April 2009 Blog Home : April 2009 : Permalink
user@server:~$ sudo fdisk -l
[sudo] password for user: XXXX
Disk /dev/sda: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000d9383
Device Boot Start End Blocks Id System
/dev/sda1 * 1 230 1847443+ 8e Linux LVM
/dev/sda2 231 261 249007+ 5 Extended
/dev/sda5 231 261 248976 83 Linux
Disk /dev/sdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000
Disk /dev/sdb doesn't contain a valid partition table
user@server:~$ sudo fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x34ff84ae.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4):
Value out of range.
Partition number (1-4): 1
First cylinder (1-522, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-522, default 522):
Using default value 522
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
user@server:~$
user@server:~$ sudo pvdisplay
--- Physical volume ---
PV Name /dev/sda1
VG Name server
PV Size 1.76 GB / not usable 4.14 MB
Allocatable yes (but full)
PE Size (KByte) 4096
Total PE 450
Free PE 0
Allocated PE 450
PV UUID FNvtw6-Z06i-l48h-kKpG-gS25-01i8-vvju1T
user@server:~$ sudo vgdisplay
--- Volume group ---
VG Name server
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 5.75 GB
PE Size 4.00 MB
Total PE 1473
Alloc PE / Size 450 / 1.76 GB
Free PE / Size 1023 / 4.00 GB
VG UUID mQpOKH-CKVp-w24Q-00fs-UWwr-2O5D-5a0fre
user@server:~$ sudo lvdisplay
--- Logical volume ---
LV Name /dev/server/root
VG Name server
LV UUID hO2d7u-IJ8t-UxN2-QArr-v3IL-M4gX-AGlZgV
LV Write Access read/write
LV Status available
# open 1
LV Size 1.62 GB
Current LE 414
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0
--- Logical volume ---
LV Name /dev/server/swap_1
VG Name server
LV UUID re64N8-iIjD-v5Tv-L6LS-KPcU-x6Xy-P2hKzK
LV Write Access read/write
LV Status available
# open 2
LV Size 144.00 MB
Current LE 36
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:1
user@server:~$
user@server:~$ sudo pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
user@server:~$ sudo pvdisplay
--- Physical volume ---
PV Name /dev/sda1
VG Name server
PV Size 1.76 GB / not usable 4.14 MB
Allocatable yes (but full)
PE Size (KByte) 4096
Total PE 450
Free PE 0
Allocated PE 450
PV UUID FNvtw6-Z06i-l48h-kKpG-gS25-01i8-vvju1T
"/dev/sdb1" is a new physical volume of "4.00 GB"
--- NEW Physical volume ---
PV Name /dev/sdb1
VG Name
PV Size 4.00 GB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
user@server:~$
user@server:~$ sudo vgextend server /dev/sdb1
Volume group "server" successfully extended
user@server:~$ sudo vgdisplay
--- Volume group ---
VG Name server
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 5.75 GB
PE Size 4.00 MB
Total PE 1473
Alloc PE / Size 450 / 1.76 GB
Free PE / Size 1023 / 4.00 GB
VG UUID mQpOKH-CKVp-w24Q-00fs-UWwr-2O5D-5a0fre
user@server:~$
user@server:~$ sudo lvextend --size +2G /dev/server/root
Extending logical volume root to 3.62 GB
Logical volume root successfully resized
user@server:~$ sudo vgdisplay
--- Volume group ---
VG Name server
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 5.75 GB
PE Size 4.00 MB
Total PE 1473
Alloc PE / Size 962 / 3.76 GB
Free PE / Size 511 / 2.00 GB
VG UUID mQpOKH-CKVp-w24Q-00fs-UWwr-2O5D-5a0fre
user@server:~$ sudo lvdisplay
--- Logical volume ---
LV Name /dev/server/root
VG Name server
LV UUID hO2d7u-IJ8t-UxN2-QArr-v3IL-M4gX-AGlZgV
LV Write Access read/write
LV Status available
# open 1
LV Size 3.62 GB
Current LE 926
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0
--- Logical volume ---
LV Name /dev/server/swap_1
VG Name server
LV UUID re64N8-iIjD-v5Tv-L6LS-KPcU-x6Xy-P2hKzK
LV Write Access read/write
LV Status available
# open 2
LV Size 144.00 MB
Current LE 36
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:1
user@server:~$