码迷,mamicode.com
首页 > 其他好文 > 详细

磁盘扩容问题

时间:2020-10-30 11:46:15      阅读:22      评论:0      收藏:0      [点我收藏+]

标签:问题   dep   lsb   分区   att   files   physical   ota   strong   

centos6.5扩容(不使用partprobe命令重读分区)

[root@host-10-0-0-15 ~]# fdisk /dev/vda

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): c
DOS Compatibility flag is not set

Command (m for help): u
Changing display/entry units to sectors

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First sector (16777216-83886079, default 16777216): 
Using default value 16777216
Last sector, +sectors or +size{K,M,G} (16777216-83886079, default 83886079): +5G

Command (m for help): p

Disk /dev/vda: 42.9 GB, 42949672960 bytes
16 heads, 63 sectors/track, 83220 cylinders, total 83886080 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 identifier: 0x0001a1bb

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048     1026047      512000   83  Linux
/dev/vda2         1026048    16777215     7875584   8e  Linux LVM
/dev/vda3        16777216    27262975     5242880   83  Linux

Command (m for help): wq
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@host-10-0-0-15 ~]# partx -a /dev/vda			#centos6.5安装partprobe命令失败,可以使用此命令代替
BLKPG: Device or resource busy
error adding partition 1
BLKPG: Device or resource busy
error adding partition 2
[root@host-10-0-0-15 ~]# lsblk 
NAME                        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
vda                         252:0    0   40G  0 disk 
├─vda1                      252:1    0  500M  0 part /boot
├─vda2                      252:2    0  7.5G  0 part 
│ ├─VolGroup-lv_root (dm-0) 253:0    0  6.7G  0 lvm  /
│ └─VolGroup-lv_swap (dm-1) 253:1    0  816M  0 lvm  [SWAP]
└─vda3                      252:3    0    5G  0 part 
[root@host-10-0-0-15 ~]# vgs
  VG       #PV #LV #SN Attr   VSize VFree
  VolGroup   1   2   0 wz--n- 7.51g    0 
[root@host-10-0-0-15 ~]# lvs
  LV      VG       Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convert
  lv_root VolGroup -wi-ao----   6.71g                                             
  lv_swap VolGroup -wi-ao---- 816.00m                                             
[root@host-10-0-0-15 ~]# pvcreate /dev/vda3 
  Physical volume "/dev/vda3" successfully created
[root@host-10-0-0-15 ~]# vgextend VolGroup /dev/vda3 
  Volume group "VolGroup" successfully extended
[root@host-10-0-0-15 ~]# vgs
  VG       #PV #LV #SN Attr   VSize  VFree
  VolGroup   2   2   0 wz--n- 12.50g 5.00g
[root@host-10-0-0-15 ~]# lvextend -L +3G /dev/VolGroup/lv_root 
  Extending logical volume lv_root to 9.71 GiB
  Logical volume lv_root successfully resized
[root@host-10-0-0-15 ~]# df -Th
Filesystem                   Type   Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root ext4   6.7G  826M  5.5G  13% /
tmpfs                        tmpfs  1.9G     0  1.9G   0% /dev/shm
/dev/vda1                    ext4   485M   32M  428M   7% /boot
[root@host-10-0-0-15 ~]# resize2fs /dev/VolGroup/lv_root 
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/VolGroup/lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/VolGroup/lv_root to 2545664 (4k) blocks.
The filesystem on /dev/VolGroup/lv_root is now 2545664 blocks long.

[root@host-10-0-0-15 ~]# df -Th
Filesystem                   Type   Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root ext4   9.6G  826M  8.3G   9% /
tmpfs                        tmpfs  1.9G     0  1.9G   0% /dev/shm
/dev/vda1                    ext4   485M   32M  428M   7% /boot

磁盘扩容问题

标签:问题   dep   lsb   分区   att   files   physical   ota   strong   

原文地址:https://www.cnblogs.com/bluesky-/p/13895951.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!