Virtual machines for Linux under VMware increase disk space

Source: Internet
Author: User

Power off the virtual machine first, do the following: " virtual Machine"--"Virtual machine settings"--"disk"--"extension"

You can optionally add the size of the disk you need to increase to (such as 15Gb, the total amount of disk, including the original disk capacity); Then restart the power supply to enter the system to do the following steps set.

1. Start the virtual machine system, log in as root (all subsequent steps should be logged in as root), and be viewed at the command line with Fdisk-l. Since this is a direct modification of the original space size, you can see that the/DEV/SDA space changes to 16.1GB (the original disk space increased from 10G to 15G). If you add a virtual hard disk from the VMware menu, will there be a/dev/sd?, here? Represents the hard disk number, the first hard disk number is a, SDA, the second is SDB, the third is SDC, and so on, generally speaking, if you have not previously increased the hard disk, The original hard drive is SDA, and the virtual hard disk number added through the VMware menu is SDB. If you add a second hard disk that is an IDE hard disk, you should see the HDB, and if it is a SCSI hard disk, you should see SDB.

2. Use FDISK/DEV/SDA to enter menu items, m is List menu, p is list partition table, n is add partition, W is save and eject. Since there are only 5 g of disks added here, 5G is zoned as a single zone.

[email protected] ~]# FDISK/DEV/SDA

The number of cylinders for this disk was set to 1958.
There is nothing wrong with the, 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 the other OSs
(e.g., DOS fdisk, OS/2 fdisk)

Command (M for help): P

disk/dev/sda:16.1 GB, 16106127360 bytes
255 heads, Sectors/track, 1958 cylinders
Units = Cylinders of 16065 * 8225280 bytes

   Device boot      start          end      blocks   id  System
/dev/sda1    *           1           13      104391   83  Linux
/dev/sda2               14        1305    10377990   8e  Linux LVM

Command (M for help): N
Command Action
E Extended
P primary partition (1-4)
P
Partition number (1-4): 3
First cylinder (1306-1958, default 1306): +1306
Last cylinder or +size or +sizem or +sizek (1306-1958, default 1958): +1958
Value out of range.
Last cylinder or +size or +sizem or +sizek (1306-1958, default 1958):
Using Default Value 1958

Command (M for help): P

disk/dev/sda:16.1 GB, 16106127360 bytes
255 heads, Sectors/track, 1958 cylinders
Units = Cylinders of 16065 * 8225280 bytes

Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 104391 Linux
/dev/sda2 1305 10377990 8e Linux LVM
/dev/sda3 1306 1958 5245222+-Up Linux

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: The device or resource is busy.
The kernel still uses the old table.
The new table is used at the next reboot.
Syncing disks.
/dev/sda3 1306 1958 5245222+-Up Linux

[email protected] ~]# reboot #需reboot一下机器继续如下步骤

[Email protected] ~]#Df-h #挂载前的分区情况
File system capacity has been used with available% mount points
/dev/mapper/volgroup00-logvol00
8.6G 2.8G 5.4G 35%/
/DEV/SDA1 99M 12M 82M 13%/boot
Tmpfs 125M 0 125M 0%/dev/shm

3. Format the partition with Mkfs.ext3/dev/sda3

[Email protected] ~]# Mkfs.ext3/dev/sda3
MKE2FS 1.39 (29-may-2006)
Filesystem label=
OS Type:linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
656000 inodes, 1311305 blocks
65565 blocks (5.00%) reserved for the Super user
First Data block=0
Maximum filesystem blocks=1346371584
Groups block
32768 blocks per group, 32768 fragments per group
16000 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 filesystem accounting Information:done

This filesystem would be automatically checked every mounts or
Whichever comes first. Use Tune2fs-c or-i to override.

[[email protected] ~]# CD/
[email protected]/]# mkdir/cm #增加一个/cm

[Email protected]/]#mount/dev/sda3/cm #挂载分区到/cm
[Email protected]/]#df-h #挂载后的分区情况
File system capacity has been used with available% mount points
/dev/mapper/volgroup00-logvol00
8.6G 2.8G 5.4G 35%/
/DEV/SDA1 99M 12M 82M 13%/boot
Tmpfs 125M 0 125M 0%/dev/shm
/dev/sda3 5.0G 139M 4.6G 3%/cm

4. Set Boot auto-load

Create mount point: After mkdir/cm mount, modify the Vi/etc/fstab partition table file,

At the end of the file add /dev/sda3/cm ext3 defaults 0 0 then save and restart.

(Note: If the partition table is incorrect, it will result in the Linux desktop system, but then the system will enter the CommandLine mode, we can fix the wrong fstab in commandline mode, However, by default this commandline mode will be the Read-only file system, which means that any modifications you make are not allowed, but you can remove this restriction by command mount/O remount,rw.

Transferred from: http://blog.itpub.net/24435147/viewspace-694200/

Virtual machines for Linux under VMware increase disk space

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.