linux - 如何使用终端而不是应用程序在VM中扩展磁盘?

标签 linux hadoop virtual-machine disk-partitioning

我使用vmware player和“clouderatrainingvm4.1.1.c”。cloudera培训是一种linux和hadoop的结合。
我现在试着展开磁盘。首先,我尝试使用第三方软件,比如gparted,但它不在cloudera培训中运行。
然后,我试图通过终端,现在我卡住了。我已经创建了一个名为sda3的分区,并试图使sda3获得可用空间并投入使用。它似乎得到了自由空间,但我仍然不能使用这个空间。

>[root@localhost training]# pvscan
   PV /dev/sda3                      lvm2 [13.79 GiB]
   Total: 1 [13.79 GiB] / in use: 0 [0   ] / in no VG: 1 [13.79 GiB]
>[root@localhost training]# lvm pvs
   PV         VG   Fmt  Attr PSize  PFree 
   /dev/sda3       lvm2 a--  13.79g 13.79g

另一张磁盘的基本信息:
>[root@localhost training]# fdisk -l
  Disk /dev/sda: 32.2 GB, 32212254720 bytes
  4 heads, 32 sectors/track, 491520 cylinders
  Units = cylinders of 128 * 512 = 65536 bytes
  Sector size (logical/physical): 512 bytes / 512 bytes
  I/O size (minimum/optimal): 512 bytes / 512 bytes
  Disk identifier: 0x00021e4f

Device Boot      Start         End      Blocks   Id  System
   /dev/sda1               1      234375    14999984   83  Linux
   /dev/sda2          234376      265625     2000000   83  Linux
   /dev/sda3          265626      491520    14457280   83  Linux

最佳答案

这应该对centos有效
执行“fdisk/dev/sda”
我假设/dev/sda2是您的lvm分区,而您没有/dev/sda3。
1)确保已在vmware中的“编辑设置”下展开vm磁盘。
2)执行“fdisk/dev/sda”

  p (to see existing partitions)
  n (new partition)         
      p (primary partition)         
      When asked "Partition number (1-4)", enter "3".       
      accept defaults.  It will use the rest of the disk    
  w (write changes)

3)重启
4)运行“pvcreate/dev/sda3”
5)运行“vgdisplay”获取卷组的名称(vg name)。在这个例子中,它是“volgroup”
6)运行vgextend volgroup/dev/sda3
7)运行lvextend/dev/volgroup/lv_root-r-l+100%空闲
(使用(-r)选项时,它也会格式化它)
8)运行“df-h”查看新的磁盘空间

关于linux - 如何使用终端而不是应用程序在VM中扩展磁盘?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22245447/

相关文章:

hadoop - 从多个表插入单个表

android - 虚拟机 Hyper-V Windows Server 2008 上的 AVD 错误

linux - x86 汇编语言 : Shift multiplication with 64 bit answer

sed 中的正则表达式替换给定特定格式的 url 的一部分

linux - 通过/dev/mem 访问 GPIO 是否更安全?

hadoop - Hadoop 中 DataNode 和 MapTask 的数量

apache - 如何检查缺少完整模式信息的 Hadoop SequenceFile?

mysql - 从转储加载 mysql 数据库需要很长时间

Azure - 重新部署 Azure 中的现有 Windows VM 以连接到虚拟网络

linux - 如何在上传时自动合并