redhat在vm扩展磁盘容量

redhat在vm扩展磁盘容量

分析:没有卷组,只能通过文件转移,挂载方式,才可以扩展容量。注意:扩展容量时,必须删除快照。为了数据安全,建议进行操作时,必须对数据进行备份。

操作如下图所示:

1.查使用容量:

[root@redhat /]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda2             985M  984M    0 100% /

tmpfs                 932M     0 932M   0% /dev/shm

2.关机对VM进行扩展磁盘容量

a.对已有容量,进行扩充


增加5G,扩展成功


b.添加多一块磁盘,方便将大文件转移到这个盘(不是唯一方法,个人是这样操作的)。如下图所示:



 






3.扩展磁盘容量

a.查看系统分区

[root@redhat ~]# fdisk -l

 

Disk /dev/sda: 32.2 GB, 32212254720 bytes

255 heads, 63 sectors/track, 3916 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes /512 bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier: 0x00039d7d

 

  Device Boot      Start         End      Blocks  Id  System

/dev/sda1               1        2484   19946496   8e  Linux LVM

/dev/sda2  *        2484        2611    1024000   83  Linux

/dev/sda3            2611        3263    5238527+  83  Linux

 

Disk /dev/sdb: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280bytes

Sector size (logical/physical): 512 bytes /512 bytes

I/O size (minimum/optimal): 512 bytes / 512bytes

Disk identifier: 0x00000000

 

b.创建分区sda4



查看是否创建完成

c.格式化(注:重启后再进行格式化)

[root@redhat ~]# mkfs.ext4 /dev/sd

sda  sda1  sda2  sda3 sda4  sdb  

[root@redhat ~]# mkfs.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

328000 inodes, 1311305 blocks

65565 blocks (5.00%) reserved for the superuser

First data block=0

Maximum filesystem blocks=1346371584

41 block groups

32768 blocks per group, 32768 fragments pergroup

8000 inodes per group

Superblock backups stored on blocks:

       32768, 98304, 163840, 229376, 294912, 819200, 884736

 

Writing inode tables: done                           

Creating journal (32768 blocks): done

Writing superblocks and filesystemaccounting information: done

 

This filesystem will be automaticallychecked every 33 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

 

d.格式化新挂载磁盘

[root@redhat ~]# mkfs.ext4 /dev/sdb

mke2fs 1.41.12 (17-May-2010)

/dev/sdb is entire device, not just onepartition!

Proceed anyway? (y,n) y

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

327680 inodes, 1310720 blocks

65536 blocks (5.00%) reserved for the superuser

First data block=0

Maximum filesystem blocks=1342177280

40 block groups

32768 blocks per group, 32768 fragments pergroup

8192 inodes per group

Superblock backups stored on blocks:

       32768, 98304, 163840, 229376, 294912, 819200, 884736

 

Writing inode tables: done                           

Creating journal (32768 blocks): done

Writing superblocks and filesystemaccounting information: done

 

This filesystem will be automaticallychecked every 36 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

 

e.设置挂载文件

[root@redhat ~]# vi /etc/fstab


将需要转移文件放到新磁盘里

[root@redhat ~]# mount  /dev/sdb  /test/

[root@redhat /]# cd /dfs/

[root@redhat dfs]# mv ./* /test/

 

再将转移文件再挂载回新自主分区

[root@redhat dfs]# mount /dev/sda4 /dfs

[root@redhat dfs]# cd /test/

[root@redhat test]# mv ./* /dfs/

f.扩展完成

 

阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hhj724/article/details/53610011
文章标签: redhat扩展容量
个人分类: linux
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

redhat在vm扩展磁盘容量

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭