CentOS扩展分区大小

黎东
L、先森
2018-02-12 0 1444

扩展分区


[root@localhost ~]df -h  
    Filesystem            Size  Used Avail Use% Mounted on  
    /dev/mapper/VolGroup-lv_root  
                           26G   20G  5.5G  78% /  
    tmpfs                 5.9G   72K  5.9G   1% /dev/shm  
    /dev/sda1             477M   68M  385M  15% /boot  

[root@localhost ~]fdisk -l  
    Disk /dev/sda: 107.4 GB, 107374182400 bytes  
    255 heads, 63 sectors/track, 13054 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: 0x00037586  
      
       Device Boot      Start         End      Blocks   Id  System  
    /dev/sda1   *           1          64      512000   83  Linux  
    Partition 1 does not end on cylinder boundary.  
    /dev/sda2              64        3917    30944256   8e  Linux LVM  
      
    Disk /dev/mapper/VolGroup-lv_root: 28.5 GB, 28462546944 bytes  
    255 heads, 63 sectors/track, 3460 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/VolGroup-lv_swap: 3221 MB, 3221225472 bytes  
    255 heads, 63 sectors/track, 391 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  
  
[root@localhost ~]lvdisplay  
      --- Logical volume ---  
      LV Path                /dev/VolGroup/lv_root  
      LV Name                lv_root  
      VG Name                VolGroup  
      LV UUID                S8KICb-emT1-PtqH-Fhgc-szCl-7lRd-tq26hj  
      LV Write Access        read/write  
      LV Creation host, time localhost.localdomain, 2016-01-25 13:04:50 +0800  
      LV Status              available  
      # open                 1  
      LV Size                26.51 GiB  
      Current LE             6786  
      Segments               1  
      Allocation             inherit  
      Read ahead sectors     auto  
      - currently set to     256  
      Block device           253:0  
      
      --- Logical volume ---  
      LV Path                /dev/VolGroup/lv_swap  
      LV Name                lv_swap  
      VG Name                VolGroup  
      LV UUID                tagUGp-5vNM-bR70-caqo-r5rb-fE0M-ZfeqY6  
      LV Write Access        read/write  
      LV Creation host, time localhost.localdomain, 2016-01-25 13:04:54 +0800  
      LV Status              available  
      # open                 1  
      LV Size                3.00 GiB  
      Current LE             768  
      Segments               1  
      Allocation             inherit  
      Read ahead sectors     auto  
      - currently set to     256  
      Block device           253:1  
  
[root@localhost ~]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): 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): 4  
    First cylinder (3917-13054, default 3917):  
    Using default value 3917  
    Last cylinder, +cylinders or +size{K,M,G} (3917-13054, default 13054):  
    Using default value 13054  
      
    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.  
    
[root@localhost ~]reboot  
  
    Broadcast message from root@localhost.localdomain  
            (/dev/pts/0) at 8:27 ...  
      
    The system is going down for reboot NOW!  
  
  
  
  
[root@localhost ~]# mkfs -t ext4 /dev/sda4  
    mke2fs 1.41.12 (17-May-2010)  
    Filesystem label=  
    OS type: Linux  
    Block size=4096 (log=2)  
    Fragment size=4096 (log=2)  
    Stride=0 blocks, Stripe width=0 blocks  
    4587520 inodes, 18349743 blocks  
    917487 blocks (5.00%) reserved for the super user  
    First data block=0  
    Maximum filesystem blocks=4294967296  
    560 block groups  
    32768 blocks per group, 32768 fragments per group  
    8192 inodes per group  
    Superblock backups stored on blocks:  
            32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,  
            4096000, 7962624, 11239424  
      
    Writing inode tables: done  
    Creating journal (32768 blocks): done  
    Writing superblocks and filesystem accounting information: done  
      
    This filesystem will be automatically checked every 39 mounts or  
    180 days, whichever comes first.  Use tune2fs -c or -i to override.  

[root@localhost ~]# pvcreate /dev/sda4  
      Physical volume "/dev/sda4" successfully created  
      
[root@localhost ~]# vgextend /dev/mapper/VolGroup  /dev/sda4  
      Volume group "VolGroup" successfully extended  
      
[root@localhost ~]# vgdisplay  
      --- Volume group ---  
      VG Name               VolGroup  
      System ID  
      Format                lvm2  
      Metadata Areas        2  
      Metadata Sequence No  4  
      VG Access             read/write  
      VG Status             resizable  
      MAX LV                0  
      Cur LV                2  
      Open LV               2  
      Max PV                0  
      Cur PV                2  
      Act PV                2  
      VG Size               99.50 GiB  
      PE Size               4.00 MiB  
      Total PE              25473  
      Alloc PE / Size       7554 / 29.51 GiB  
      Free  PE / Size       17919 / 70.00 GiB  
      VG UUID               xFBNk3-FQKV-KVLP-vnon-gA0Y-ouVV-MqBbkO  
  
[root@localhost ~]# lvextend -L +69.9G /dev/mapper/VolGroup-lv_root  /dev/sda4  
      Rounding size to boundary between physical extents: 69.90 GiB  
      Size of logical volume VolGroup/lv_root changed from 26.51 GiB (6786 extents) to 96.41 GiB (24681 extents).  
      Logical volume lv_root successfully resized  
      
[root@localhost ~]# resize2fs /dev/mapper/VolGroup-lv_root  
    resize2fs 1.41.12 (17-May-2010)  
    Filesystem at /dev/mapper/VolGroup-lv_root is mounted on /; on-line resizing required  
    old desc_blocks = 2, new_desc_blocks = 7  
    Performing an on-line resize of /dev/mapper/VolGroup-lv_root to 25273344 (4k) blocks.  
    The filesystem on /dev/mapper/VolGroup-lv_root is now 25273344 blocks long.  
  
[root@localhost ~]# df -h  
    Filesystem            Size  Used Avail Use% Mounted on  
    /dev/mapper/VolGroup-lv_root  
                           95G   20G   71G  22% /  
    tmpfs                 5.9G   72K  5.9G   1% /dev/shm  
    /dev/sda1             477M   68M  385M  15% /boot


linux