centos lvm扩容

2018年3月29日 0 条评论 1.6k 次阅读 0 人点赞

[root@dev-caigou ~]# fdisk /dev/sda
sda   sda1  sda2  
[root@dev-caigou ~]# 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): 3
First sector (41943040-125829119, default 41943040): 
Using default value 41943040
Last sector, +sectors or +size{K,M,G} (41943040-125829119, default 125829119): 
Using default value 125829119
Partition 3 of type Linux and of size 40 GiB is set

Command (m for help): t   
Partition number (1-3, default 3): 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.
[root@dev-caigou ~]# partprobe
[root@dev-caigou ~]# mkfs -t ext3 /dev/sda3 
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
2621440 inodes, 10485760 blocks
524288 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
320 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

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done   
[root@dev-caigou ~]# vgextend centos /dev/sda3
WARNING: ext3 signature detected on /dev/sda3 at offset 1080. Wipe it? [y/n]: y
  Wiping ext3 signature on /dev/sda3.
  Physical volume "/dev/sda3" successfully created.
  Volume group "centos" successfully extended
[root@dev-caigou ~]# lvextend -L 56G /dev/centos/root
  Size of logical volume centos/root changed from 55.00 GiB (14080 extents) to 56.00 GiB (14336 extents).
  Logical volume centos/root successfully resized.
[root@dev-caigou ~]# resize2fs /dev/centos/root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/centos/root
Couldn't find valid filesystem superblock.
[root@dev-caigou ~]# xfs_
xfs_admin      xfs_copy       xfs_estimate   xfs_fsr        xfs_info       xfs_logprint   xfs_metadump   xfs_ncheck     xfs_repair     
xfs_bmap       xfs_db         xfs_freeze     xfs_growfs     xfs_io         xfs_mdrestore  xfs_mkfile     xfs_quota      xfs_rtcp  
[root@dev-caigou ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   56G  3.3G   53G   6% /
devtmpfs                 1.9G     0  1.9G   0% /dev
tmpfs                    1.9G     0  1.9G   0% /dev/shm
tmpfs                    1.9G  8.5M  1.9G   1% /run
tmpfs                    1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sda1               1014M  189M  826M  19% /boot
tmpfs                    380M     0  380M   0% /run/user/1000

centos7中 最后重设大小原使用命令由 centos6中的 resize2fs 改为xfs_growfs 即可

Sevenfal

这个人太懒什么东西都没留下

文章评论(0)