為Linux虛擬機器增加磁碟空間

self_control發表於2016-05-23
在做Oracle 備份恢復實驗時,發現我的Linux虛擬機器空間不足。
以下為增加10G空間的步驟。
一    將Linux系統Power Off ,在虛擬機器設定中選擇 Add-->Hard Disk-->Next ....
二    啟動Linux,用Root使用者進入系統
三    為磁碟建立檔案系統:mkfs.ext3 /dev/sdb
四    掛載
    [root@xugj ~]#  mkdir /mnt/sdb
    [root@xugj ~]#  mount /dev/sdb   /mnt/sdb
五    分割槽: fdisk /dev/sdb

點選(此處)摺疊或開啟

  1. [root@xugj ~]# fdisk /dev/sdb
  2. Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklab el
  3. Building a new DOS disklabel. Changes will remain in memory only,
  4. until you decide to write them. After that, of course, the previous
  5. content won't be recoverable.
  6. The number of cylinders for this disk is set to 1305.
  7. There is nothing wrong with that, but this is larger than 1024,
  8. and could in certain setups cause problems with:
  9. 1) software that runs at boot time (e.g., old versions of LILO)
  10. 2) booting and partitioning software from other OSs
  11. (e.g., DOS FDISK, OS/2 FDISK)
  12. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
  13. Command (m for help): m
  14. Command action
  15. a toggle a bootable flag
  16. b edit bsd disklabel
  17. c toggle the dos compatibility flag
  18. d delete a partition
  19. l list known partition types
  20. ………………
  21. Command (m for help): n
  22. Command action
  23. e extended
  24. p primary partition (1-4)
  25. p
  26. Partition number (1-4): 1
  27. First cylinder (1-1305, default 1):
  28. Using default value 1
  29. Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):
  30. Using default value 1305
  31. Command (m for help): p
  32. Disk /dev/sdb: 10.7 GB, 10737418240 bytes
  33. 255 heads, 63 sectors/track, 1305 cylinders
  34. Units = cylinders of 16065 * 512 = 8225280 bytes
  35. Device Boot Start End Blocks Id System
  36. /dev/sdb1 1 1305 10482381 83 Linux
  37. Command (m for help): w
  38. The partition table has been altered!
  39. Calling ioctl() to re-read partition table.
  40. WARNING: Re-reading the partition table failed with error 0: 成功.
  41. The kernel still uses the old table.
  42. The new table will be used at the next reboot.
  43. Syncing disks.

六: 將“掛載”動作新增到開機執行中
[root@xugj ~]# vi /etc/fstab
 新增一行:
 /dev/sdb       /mnt/sdb    ext3    defaults        0 1

七:檢驗
[root@xugj ~]# df -h
檔案系統                                                      容量              已用         可用         已用%    掛載點
/dev/mapper/VolGroup00-LogVol00                 5.7G             4.8G         596M        90%        /
/dev/sda1                                                    99M              9.8M         84M          11%        /boot
tmpfs                                                          379M            0               379M         0%        /dev/shm
/dev/mapper/VolGroup00-LogVol01                 4.9G             2.8G         1.9G          61%       /home
/dev/mapper/VolGroup00-LogVol03                 279M            48M          218M         18%       /tmp
/dev/sdb                                                      9.9G             151M        9.2G          2%         /var

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30066956/viewspace-2105607/,如需轉載,請註明出處,否則將追究法律責任。

相關文章