linux硬盘扩容

[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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值