VMware Virtual machine Ubuntu increases hard disk space

Source: Internet
Author: User

Android4.1 source out, nothing also want to download down to see, the results of the tragic discovery of the virtual machine to Ubuntu allocated hard disk space is too small, the remaining 2.7G. In the official documentation: the source download is approximately 6GB in size, which indicates that the source code size is around 6G, and has to mount a 20G hard drive for Ubuntu in the VMware virtual machine.

(1) Increase the virtual machine hard disk.

First, open the setting inside the VM inside VMware. Such as:

Enter the Setup screen:

Select Hard Disk and click Add below:

Click Next: Select Create a new virtual disk

Then select Next and choose SCSI for the hard drive type.

Continue next to set the hard disk size:

Continue: Specify hard disk files

This is the first to create a 20G hard drive, but Ubuntu does not recognize it. You have to format the hard disk, and then hang it on Ubuntu to tell him to launch the new partition on Mount.

(2) format the hard drive in Ubuntu and re-mount the new folder.

Inside the command line:

A) #sudo fdisk-l

View current Ubuntu disk information and discover that the newly added hard drive (/DEV/SDB) has not been partitioned

disk/dev/sda:21.5 GB, 21474836480 bytes
255 heads, Sectors/track, 2610 cylinders, total 41943040 sectors
units = sectors of 1 * = bytes
sector size (logical/physical): bytes/512 bytes
i/o size (minimum/optimal): BYTES/5 Bytes
disk identifier:0x00040a03

device Boot      start         End      blocks   Id  system
/DEV/SDA1 & nbsp          2048     2000895      999424    linux swap/solar is
/dev/sda2   *     2000896     3000319     &NB sp;499712    linux
/dev/sda3         3000320 & nbsp  41940991    19470336    linux

disk/dev/sdb:42.9 GB, 42949672960 bytes
255 heads, Sectors/track, 5221 cylinders, total 83886080 sectors
Units = sectors of 1 * MB = bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
Disk/dev/sdb doesn ' t contain a valid partition table-----This is the newly added hard drive

b) Partitioning the/dev/sdb to get/DEV/SDB1

[email protected]:~$ sudo fdisk/dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF Disklabel
Building a new DOS disklabel with disk identifier 0X204BFFC4.
Changes'll remain in memory only, until the decide to write them.
After that, of course, the previous content won ' t is recoverable.
Warning:invalid flag 0x0000 of partition Table 4 would be a corrected by W (rite)
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): N
Partition Type:
P Primary (0 primary, 0 extended, 4 free)
E Extended
Select (default p): P
Partition number (1-4, default 1): 1
First sector (2048-83886079, default 2048): 2048
Last sector, +sectors or +size{k,m,g} (2048-83886079, default 83886079):
Using Default Value 83886079

Command (M for help): W
The partition table has been altered!

Calling IOCTL () to re-read partition table.
Syncing disks

c) Format the new partition/DEV/SDB1

[email protected]:~$ sudo mkfs.ext4/dev/sdb1
MKE2FS 1.42 (29-nov-2011)
File System label =
OS Type:linux
Block size =4096 (log=2)
Chunked size =4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
2621440 inodes, 10485504 blocks
524275 blocks (5.00%) reserved for the Super user
First block of data =0
Maximum filesystem blocks=4294967296
Groups block
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624
Allocating group tables: complete
Writing Inode table: complete
Creating Journal (32768 blocks): complete
Writing Superblocks and FileSystem accounting information: Complete

D) Mount the newly created partition in the specified directory (for example, create a/home/download directory)

Mount/dev/sdb1/home/download-t ext4 where home/download is replaced with an empty folder you want to mount. So we find download This folder, we will find that it has nearly 20G of space, mounted successfully.

For example, execution df-h will see

[email protected]:~$ df-h
file system capacity has been used with available% mount points
/dev/sda3 19G 8.6G 9.1G 49%/
udev 486M 4.0K 486M 1%/dev
tmpfs 198M 812K 197M 1%/run
None 5.0M 0 5.0M 0%/run/lock
None 495M 152K 495M 1%/run/shm
/dev/sda2 485M 47M 415M 11%/boot
/dev/sdb1 20G 733M 20G 2%/home/download
[Email protected]:~$

e) To avoid re-mounting the/DEV/SDB1 partition after each reboot, we can modify the/etc/fstab file directly and add the following to the last line:

/dev/sdb1/home/download Auto RW 0 0

save exit, reboot after

[email protected]:~$ df-h
File system         capacity   used   available% mount points
/dev/sda3        19g  8.6g  9.1g   49%/
Udev            486m  4.0k  486m    1%/dev
Tmpfs   &NB Sp       198M  816k  197m    1%/run
None            5.0m     0  5.0m    0%/run/lock
None            495m  152k &NB sp;495m    1%/RUN/SHM
/dev/sda2       485M   47M  415m   11%/boot
/dev/sdb 1        20g  733m   20G    2%/home/download
[email protected]:~$ 

VMware Virtual machine Ubuntu increases hard 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.