ITPub博客

首页 > Linux操作系统 > Linux操作系统 > vmware server 增加根分区的方法

vmware server 增加根分区的方法

原创 Linux操作系统 作者:liqilin0429 时间:2011-06-07 15:51:55 0 删除 编辑
                        vmware server 增加根分区空间的办法 2011-5-31 15:41:26
第一 修改磁盘分区的大小
C:\Program Files\VMware\VMware Server> vmware-vdiskmanager -x 60Gb "D:\rac\node1_1\node1.vmdk"
Failed to expand the disk 'D:\rac\node1_1\node1.vmdk': The file already exists (0x270000000c).
C:\Program Files\VMware\VMware Server> vmware-vdiskmanager -x 70Gb "D:\rac\node1_1\node1.vmdk"
Failed to expand the disk 'D:\rac\node1_1\node1.vmdk': The file already exists (0x270000000c).
如果出现以上的错误提示 需要在D:\rac\node1_1\ 删除文件node1.vmdk.dfgshkgrw-tmp就可以了
C:\Program Files\VMware\VMware Server> vmware-vdiskmanager -x 50Gb "D:\rac\node1_1\node1.vmdk"
  Grow: 33% done.
C:\Program Files\VMware\VMware Server> vmware-vdiskmanager -x 50Gb "D:\rac\node1
_1\node1.vmdk"
  Grow: 100% done.
Disk expansion completed successfully.
WARNING: If the virtual disk is partitioned, you must use a third-party
         utility in the virtual machine to expand the size of the
         partitions. For more information, see:
         http://www.vmware.com/support/kb/enduser/std_adp.php?p_faqid=1647
  大约等待10多分钟就可以了
第二:查看
[root@node2 ~]# fdisk -l
Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          25      200781   83  Linux
/dev/sda2              26         305     2249100   82  Linux swap / Solaris
/dev/sda3             306        2610    18514912+  83  Linux

第三 扩张磁盘分区
[root@node2 ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 7832.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
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): p
Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          25      200781   83  Linux
/dev/sda2              26         305     2249100   82  Linux swap / Solaris
/dev/sda3             306        2610    18514912+  83  Linux
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Selected partition 4
First cylinder (2611-7832, default 2611):
Using default value 2611
Last cylinder or +size or +sizeM or +sizeK (2611-7832, default 7832):
Using default value 7832
Command (m for help): p
Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          25      200781   83  Linux
/dev/sda2              26         305     2249100   82  Linux swap / Solaris
/dev/sda3             306        2610    18514912+  83  Linux
/dev/sda4            2611        7832    41945715    5  Extended
Command (m for help): n
First cylinder (2611-7832, default 2611):
Using default value 2611
Last cylinder or +size or +sizeM or +sizeK (2611-7832, default 7832):
Using default value 7832
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.
Syncing disks.
 
第四 查看
[root@node2 ~]# fdisk -l
\
Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          25      200781   83  Linux
/dev/sda2              26         305     2249100   82  Linux swap / Solaris
/dev/sda3             306        2610    18514912+  83  Linux
/dev/sda4            2611        7832    41945715    5  Extended
/dev/sda5            2611        7832    41945683+  83  Linux
第五 从新启动系统
[root@node2 ~]# init 6 重新启动系统再格式化
第六 格式化分区
[root@node2 ~]# mkfs.ext3 /dev/sda5
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
5248992 inodes, 10486420 blocks
524321 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
321 block groups
32768 blocks per group, 32768 fragments per group
16352 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624
Writing inode tables: done                           
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
第七:创建新的挂在分区
增加文件夹/opt/sda5。这里增加的文件夹是为了挂载新增加的分区。
[root@node2 ~]# mkdir -p /u01/sda5
第八: 修改文件/etc/fstab,挂载/dev/sda5到/opt/sda5下
先备份:[root@node2 ~]# cp /etc/fstab /etc/fstab.bak
再修改  [root@node2 ~]# cd /etc
[root@node2 etc]# vi fstab
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
LABEL=SWAP-sda2         swap                    swap    defaults        0 0
/dev/sda5               /u01/sda5               ext3    defaults        1 1
第九: 重启reboot
第十 查看
[root@node2 ~]# df -l
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda3             17934852  17009560         0 100% /
/dev/sda1               194442     12077    172326   7% /boot
tmpfs                   555960         0    555960   0% /dev/shm
/dev/sda5             41286796    180240  39009272   1% /u01/sda5
现在挂载已经成功。但是,由于系统空间小的问题并没有解决(/dev/sda3空间没有剩余),因此还需要进一步修改配置。
第十一 拷贝/opt下的所有文件到/u01/sda5下:
[root@node2 ~]# cp -r /opt/* /u01/sda5/
第十二   重新修改/etc/fstab文件,挂载/dev/sda5到/opt目录下这一步修改文件重启后才能生效。但是修改完后暂时不要重启。
/dev/sda5            /opt               ext3       defaults              1 1
第十三 保留/opt文件夹,但是删除/opt下的所有文件,为挂载做准备。
[root@node2 ~]# cd /opt
[root@node2 opt]# ll
total 12
drwxrwxr-x 5 oracle oinstall 4096 May 26 11:08 ora10g
drwxr-xr-x 3 root   root     4096 May 25 09:13 oracle
drwxr-xr-x 3 root   root     4096 May 26 10:19 ORCLfmap
[root@node2 opt]# rm -fr *
第十四 删除完后重启。重启后用命令观察是否挂载成功,正常情况下应该能够顺利完成。如果挂载失败,应修改文件/etc/fstab并且用命令mount重新挂载:mount /dev/sda5 /opt
第十五 查看
[root@node2 ~]# df -l
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda3             17934852   3673708  13335400  22% /
/dev/sda1               194442     12077    172326   7% /boot
tmpfs                   555960         0    555960   0% /dev/shm
/dev/sda5             41286796   4168020  35021492  11% /opt
第十六 修改文件的权限
[root@node2 ~]# chown -R oracle:oinstall /opt/ora10g/
[root@node2 ~]# chmod -R 775 /opt/ora10g/
第十七 查看权限
[root@node2 opt]# ll
total 28
drwx------ 2 root   root     16384 May 31 13:38 lost+found
drwxrwxr-x 5 oracle oinstall  4096 May 31 14:06 ora10g
drwxr-xr-x 3 root   root      4096 May 31 14:12 oracle
drwxr-xr-x 3 root   root      4096 May 31 14:12 ORCLfmap
 
 
 
 
 
 
 
 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/20976446/viewspace-697314/,如需转载,请注明出处,否则将追究法律责任。

下一篇: linux 之LVM
请登录后发表评论 登录
全部评论

注册时间:2010-08-13

  • 博文量
    100
  • 访问量
    197896