linux硬盘扩容
2015-08-28 10:50
627 查看
[root@bigdata~]# fdisk -l
Disk /dev/sdb: 899.0 GB, 898999779328 bytes
255 heads, 63 sectors/track, 109297 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/sda: 899.0 GB, 898999779328 bytes
255 heads, 63 sectors/track, 109297 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: 0x0009cd20
[root@bigdata ~]# 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 0xc8c7b959.
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)
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): 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)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-109297, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-109297, default 109297):
Using default value 109297
Command (m for help): p
Disk /dev/sdb: 899.0 GB, 898999779328 bytes
255 heads, 63 sectors/track, 109297 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: 0xc8c7b959
Device Boot Start End Blocks Id System
/dev/sdb1 1 109297 877928121 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@bigdata ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 rootvg lvm2 a-- 836.25g 773.26g
[root@bigdata ~]# pvcreate /dev/sdb1
dev_is_mpath: failed to get device for 8:17
Physical volume "/dev/sdb1" successfully created
[root@bigdata ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 rootvg lvm2 a-- 836.25g 773.26g
/dev/sdb1 lvm2 a-- 837.26g 837.26g
[root@bigdata ~]# vgextend rootvg /dev/sdb1
Volume group "rootvg" successfully extended
[root@bigdata ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 rootvg lvm2 a-- 836.25g 773.26g
/dev/sdb1 rootvg lvm2 a-- 837.25g 837.25g
[root@bigdata ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-lvroot 9.9G 388M 9.0G 5% /
tmpfs 253G 224K 253G 1% /dev/shm
/dev/sda1 1008M 63M 895M 7% /boot
/dev/mapper/rootvg-lvhome 1008M 34M 924M 4% /home
/dev/mapper/rootvg-lvopt 4.0G 136M 3.7G 4% /opt
/dev/mapper/rootvg-lvtmp 3.0G 69M 2.8G 3% /tmp
/dev/mapper/rootvg-lvusr 7.9G 2.3G 5.3G 31% /usr
/dev/mapper/rootvg-lvvar 2.0G 168M 1.8G 9% /var
[root@bigdata ~]# lvextend -L +837G /dev/mapper/rootvg-lvroot /dev/sdb1
Extending logical volume lvroot to 847.00 GiB
Logical volume lvroot successfully resized
[root@bigdata ~]# resize2fs /dev/mapper/rootvg-lvroot
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/rootvg-lvroot is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 53
Performing an on-line resize of /dev/mapper/rootvg-lvroot to 222035968 (4k) blocks.
The filesystem on /dev/mapper/rootvg-lvroot is now 222035968 blocks long.
[root@bigdata ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-lvroot 834G 409M 791G 1% /
tmpfs 253G 224K 253G 1% /dev/shm
/dev/sda1 1008M 63M 895M 7% /boot
/dev/mapper/rootvg-lvhome 1008M 34M 924M 4% /home
/dev/mapper/rootvg-lvopt 4.0G 136M 3.7G 4% /opt
/dev/mapper/rootvg-lvtmp 3.0G 69M 2.8G 3% /tmp
/dev/mapper/rootvg-lvusr 7.9G 2.3G 5.3G 31% /usr
/dev/mapper/rootvg-lvvar 2.0G 168M 1.8G 9% /var
Disk /dev/sdb: 899.0 GB, 898999779328 bytes
255 heads, 63 sectors/track, 109297 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/sda: 899.0 GB, 898999779328 bytes
255 heads, 63 sectors/track, 109297 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: 0x0009cd20
[root@bigdata ~]# 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 0xc8c7b959.
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)
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): 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)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-109297, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-109297, default 109297):
Using default value 109297
Command (m for help): p
Disk /dev/sdb: 899.0 GB, 898999779328 bytes
255 heads, 63 sectors/track, 109297 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: 0xc8c7b959
Device Boot Start End Blocks Id System
/dev/sdb1 1 109297 877928121 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@bigdata ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 rootvg lvm2 a-- 836.25g 773.26g
[root@bigdata ~]# pvcreate /dev/sdb1
dev_is_mpath: failed to get device for 8:17
Physical volume "/dev/sdb1" successfully created
[root@bigdata ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 rootvg lvm2 a-- 836.25g 773.26g
/dev/sdb1 lvm2 a-- 837.26g 837.26g
[root@bigdata ~]# vgextend rootvg /dev/sdb1
Volume group "rootvg" successfully extended
[root@bigdata ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 rootvg lvm2 a-- 836.25g 773.26g
/dev/sdb1 rootvg lvm2 a-- 837.25g 837.25g
[root@bigdata ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-lvroot 9.9G 388M 9.0G 5% /
tmpfs 253G 224K 253G 1% /dev/shm
/dev/sda1 1008M 63M 895M 7% /boot
/dev/mapper/rootvg-lvhome 1008M 34M 924M 4% /home
/dev/mapper/rootvg-lvopt 4.0G 136M 3.7G 4% /opt
/dev/mapper/rootvg-lvtmp 3.0G 69M 2.8G 3% /tmp
/dev/mapper/rootvg-lvusr 7.9G 2.3G 5.3G 31% /usr
/dev/mapper/rootvg-lvvar 2.0G 168M 1.8G 9% /var
[root@bigdata ~]# lvextend -L +837G /dev/mapper/rootvg-lvroot /dev/sdb1
Extending logical volume lvroot to 847.00 GiB
Logical volume lvroot successfully resized
[root@bigdata ~]# resize2fs /dev/mapper/rootvg-lvroot
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/rootvg-lvroot is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 53
Performing an on-line resize of /dev/mapper/rootvg-lvroot to 222035968 (4k) blocks.
The filesystem on /dev/mapper/rootvg-lvroot is now 222035968 blocks long.
[root@bigdata ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-lvroot 834G 409M 791G 1% /
tmpfs 253G 224K 253G 1% /dev/shm
/dev/sda1 1008M 63M 895M 7% /boot
/dev/mapper/rootvg-lvhome 1008M 34M 924M 4% /home
/dev/mapper/rootvg-lvopt 4.0G 136M 3.7G 4% /opt
/dev/mapper/rootvg-lvtmp 3.0G 69M 2.8G 3% /tmp
/dev/mapper/rootvg-lvusr 7.9G 2.3G 5.3G 31% /usr
/dev/mapper/rootvg-lvvar 2.0G 168M 1.8G 9% /var
相关文章推荐
- [工作需求]linux常用命令以及vim常用命令
- 【linux】crontab的定时任务示例
- linux-sudo apt-get update
- Linux启动管理-运行级别
- Linux 中使用 clone 函数
- Linux下Mysql 5.6+的安装
- Linux下使用vi命令后退出方式
- Linux的tail 命令
- linux下vi修改文件用法
- linux命令中分页等管道符的使用
- 在linux的驱动Makefile中添加调试选项
- 文件管理系统的学习
- Linux学习笔记-----Linux服务管理----讲12.1 Linux服务管理-----服务分类
- 在Linux操作系统中修改环境变量的方法
- centos+bridge
- Linux环境中MySQL主从同步--添加新的从库
- Linux环境中MySQL主从同步--添加新的从库
- PHP在linux上执行外部命令(整理)
- 虚拟机Linux系统修复_偏方
- Linux awk命令详解