Add a new disk to a lvm2 partition (in ubuntu)
In my case i add partition /dev/hdc2 to lvm2 group
sudo su
pvscan
PV /dev/hda6 VG Ubuntu lvm2 [20.81 GB / 0 free]
PV /dev/hdc1 VG Ubuntu lvm2 [9.77 GB / 0 free]
Total: 2 [30.58 GB] / in use: 2 [30.58 GB] / in no VG: 0 [0 ]
fdisk /dev/hdc
Command (m for help): p
Disk /dev/hdc: 41.1 GB, 41110142976 bytes
255 heads, 63 sectors/track, 4998 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdc1 * 1 1275 10241406 8e Linux LVM
/dev/hdc2 1276 4998 29904997+ 83 Linux
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 82
Changed system type of partition 2 to 82 (Linux swap / Solaris)
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/hdc: 41.1 GB, 41110142976 bytes
255 heads, 63 sectors/track, 4998 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdc1 * 1 1275 10241406 8e Linux LVM
/dev/hdc2 1276 4998 29904997+ 8e Linux LVM
pvcreate /dev/hdc2
Physical volume "/dev/hdc2" successfully created
pvscan
PV /dev/hda6 VG Ubuntu lvm2 [20.81 GB / 0 free]
PV /dev/hdc1 VG Ubuntu lvm2 [9.77 GB / 0 free]
PV /dev/hdc2 lvm2 [28.52 GB]
Total: 3 [59.10 GB] / in use: 2 [30.58 GB] / in no VG: 1 [28.52 GB]
vgextend Ubuntu /dev/hdc2
Volume group "Ubuntu" successfully extended
pvscan
PV /dev/hda6 VG Ubuntu lvm2 [20.81 GB / 0 free]
PV /dev/hdc1 VG Ubuntu lvm2 [9.77 GB / 0 free]
PV /dev/hdc2 VG Ubuntu lvm2 [28.52 GB / 28.52 GB free]
Total: 3 [59.09 GB] / in use: 3 [59.09 GB] / in no VG: 0 [0 ]
root@borkstation32:/home/ubuntu# lvextend -L+28G /dev/Ubuntu/root
Extending logical volume root to 57.70 GB
Logical volume root successfully resized
lvextend -L+528M /dev/Ubuntu/root
Extending logical volume root to 58.21 GB
Logical volume root successfully resized
e2fsck -f /dev/Ubuntu/root
resize2fs /dev/Ubuntu/root
You can check the new size with mount /dev/Ubuntu/root /mnt and then df
and reboot :)
All was don with an live cd (my root partition is on the lvm so i had to take it offline)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment