vmware server 增加根分割槽的方法

liqilin0429發表於2011-06-07
                        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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章