<pre name="code" class="sql">pay:/root# fdisk -l Disk /dev/sda: 10.7 GB, 10737418240 bytes 64 heads, 32 sectors/track, 10240 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0002b1a2 Device Boot Start End Blocks Id System /dev/sda1 * 2 201 204800 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 202 10201 10240000 8e Linux LVM Partition 2 does not end on cylinder boundary. Disk /dev/mapper/vg00-lv_root: 8321 MB, 8321499136 bytes 255 heads, 63 sectors/track, 1011 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/mapper/vg00-lv_swap: 2147 MB, 2147483648 bytes 255 heads, 63 sectors/track, 261 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 pay:/root# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg00-lv_root 7.7G 1.9G 5.4G 26% / tmpfs 246M 0 246M 0% /dev/shm /dev/sda1 194M 29M 155M 16% /boot 添加磁盘后: pay:/root# fdisk -l Disk /dev/sda: 53.7 GB, 53687091200 bytes 64 heads, 32 sectors/track, 51200 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0002b1a2 Device Boot Start End Blocks Id System /dev/sda1 * 2 201 204800 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 202 10201 10240000 8e Linux LVM Partition 2 does not end on cylinder boundary. Disk /dev/mapper/vg00-lv_root: 8321 MB, 8321499136 bytes 255 heads, 63 sectors/track, 1011 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/mapper/vg00-lv_swap: 2147 MB, 2147483648 bytes 255 heads, 63 sectors/track, 261 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 新加的磁盘从10202 开始到51200 pay:/root# fdisk /dev/sda WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): p Disk /dev/sda: 53.7 GB, 53687091200 bytes 64 heads, 32 sectors/track, 51200 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0002b1a2 Device Boot Start End Blocks Id System /dev/sda1 * 2 201 204800 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 202 10201 10240000 8e Linux LVM Partition 2 does not end on cylinder boundary. Command (m for help): n Command action e extended p primary partition (1-4) 3 Invalid partition number for type `3' Command action e extended p primary partition (1-4) ^C pay:/root# fdisk /dev/sda WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): p Disk /dev/sda: 53.7 GB, 53687091200 bytes 64 heads, 32 sectors/track, 51200 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0002b1a2 Device Boot Start End Blocks Id System /dev/sda1 * 2 201 204800 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 202 10201 10240000 8e Linux LVM Partition 2 does not end on cylinder boundary. Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 3 First cylinder (1-51200, default 1): 10202 Last cylinder, +cylinders or +size{K,M,G} (10202-51200, default 51200): Using default value 51200 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. pay:/root# fdisk -l Disk /dev/sda: 53.7 GB, 53687091200 bytes 64 heads, 32 sectors/track, 51200 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0002b1a2 Device Boot Start End Blocks Id System /dev/sda1 * 2 201 204800 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 202 10201 10240000 8e Linux LVM Partition 2 does not end on cylinder boundary. /dev/sda3 10202 51200 41982976 83 Linux Disk /dev/mapper/vg00-lv_root: 8321 MB, 8321499136 bytes 255 heads, 63 sectors/track, 1011 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/mapper/vg00-lv_swap: 2147 MB, 2147483648 bytes 255 heads, 63 sectors/track, 261 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 pay:/root# pvcreate /dev/sda3 Physical volume "/dev/sda3" successfully created pay:/root# vgextend vg00 /dev/sda3 Volume group "vg00" successfully extended pay:/root# lvextend -L +30G /dev/mapper/vg00-lv_root Extending logical volume lv_root to 37.75 GiB Logical volume lv_root successfully resized pay:/root# resize2fs /dev/mapper/vg00-lv_root resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/mapper/vg00-lv_root is mounted on /; on-line resizing required old desc_blocks = 1, new_desc_blocks = 3 Performing an on-line resize of /dev/mapper/vg00-lv_root to 9895936 (4k) blocks. The filesystem on /dev/mapper/vg00-lv_root is now 9895936 blocks long. pay:/root# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg00-lv_root 38G 1.9G 34G 6% / tmpfs 246M 0 246M 0% /dev/shm /dev/sda1 194M 29M 155M 16% /boo