ESXI CentOS7 Extend HDD 紀錄一下 32G --> 320G

# fdisk -l

Disk /dev/sda: 34.4 GB, 34359738368 bytes, 67108864 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
............
# ls /sys/class/scsi_device/
1:0:0:0  2:0:0:0
# echo 1 > /sys/class/scsi_device/1\:0\:0\:0/device/rescan
# echo 1 > /sys/class/scsi_device/2\:0\:0\:0/device/rescan
# ls  /sys/class/scsi_host/
host0  host1  host2
# echo "- - -" > /sys/class/scsi_host/host0/scan
# echo "- - -" > /sys/class/scsi_host/host1/scan
# echo "- - -" > /sys/class/scsi_host/host2/scan
# fdisk -l
Disk /dev/sda: 343.6 GB, 343597383680 bytes, 671088640 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
........
#  fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p): p
Partition number (3,4, default 3):
First sector (67108864-671088639, default 67108864):
Using default value 67108864
Last sector, +sectors or +size{K,M,G} (67108864-671088639, default 671088639):
Using default value 671088639
Partition 3 of type Linux and of size 288 GiB is set

Command (m for help): t
Partition number (1-3, default 3):
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

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.
# partprobe -s
/dev/sda: msdos partitions 1 2 3

]# pvcreate /dev/sda3
  Physical volume "/dev/sda3" successfully created.
[root@test ~]#  vgdisplay
  --- Volume group ---
  VG Name               centos
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               31.51 GiB
  PE Size               4.00 MiB
  Total PE              8066
  Alloc PE / Size       8055 / 31.46 GiB
  Free  PE / Size       11 / 44.00 MiB
  VG UUID               1jjmr9-Q026-XcEp-5661-wTYl-Ollk-kXUSv8

[root@test ~]#  vgextend centos /dev/sda3
  Volume group "centos" successfully extended

  ]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                WEJ3jH-Q3cV-0dY5-b1wa-W06A-C270-hRuiKD
  LV Write Access        read/write
  LV Creation host, time localhost, 2015-08-18 12:32:57 +0800
  LV Status              available
  # open                 2
  LV Size                2.00 GiB
  Current LE             512
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/centos/root
  LV Name                root
  VG Name                centos
  LV UUID                VQ6mxx-SUC4-OO2c-6bN2-vuzD-Hvwi-06jpwr
  LV Write Access        read/write
  LV Creation host, time localhost, 2015-08-18 12:32:57 +0800
  LV Status              available
  # open                 1
  LV Size                29.46 GiB
  Current LE             7543
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0
]# lvextend /dev/centos/root /dev/sda3
  Size of logical volume centos/root changed from 29.46 GiB (7543 extents) to 317.46 GiB (81270 extents).
  Logical volume centos/root successfully resized.
 xfs_info /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=256    agcount=4, agsize=1931008 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=7724032, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal               bsize=4096   blocks=3771, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@test ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=256    agcount=4, agsize=1931008 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=7724032, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal               bsize=4096   blocks=3771, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 7724032 to 83220480
[root@test ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  318G   16G  302G   6% /


arrow
arrow
    全站熱搜

    echochio 發表在 痞客邦 留言(0) 人氣()