How to increase disk space for linux operating systems installed on virtual machines

Source: Internet
Author: User


Today, the worker wants to add a hard disk to the new linux operating system on the virtual machine. In fact, it is not his existing virtual machine hard disk space is insufficient, however, when he dragged a file from windows to linux, he found that the space was insufficient. What is the situation? Why is it insufficient? In fact, he found that when dragging files from windows to linux, he did not drag the files directly to the directory he specified, but copied the files to the/tmp directory first, then copy/tmp to the specified directory. Currently, the/tmp space is insufficient, and the drag-and-drop operation fails. Later, he found me and thought about it. the/tmp directory www.2cto.com sudo cp/tmp is backed up. /tmp. old 2. delete the/tmp directory and create a new soft connection sudo rm/tmp sudo ln-s user home directory/tmp. After step 2, our/tmp still exists, however, when data is stored in the/tmp directory, it is not stored in the/tmp directory, but stored in the user's main directory. Because the user's main directory has a large space, it solves the problem of insufficient/tmp space and finally achieves the desired result. If you want to solve the problem, you can always solve it. Now let's take a look at how to increase disk space for the installed linux system. log out of LINUX, select Settings under the VM menu on the vmware startup interface to add a disk, select add, select hard disk, and click Next. 2. Select create a new virtual disk and click Next. Select scsi to continue. Select the size of the new disk and select Allocate all disk space now to Allocate space immediately. Next, select a directory on your hard disk to create the disk. Click Finish. In this way, a new space is created. Www.2cto.com 3. enter the name of the new hard disk, which will be placed in the location of your virtual machine by default. 4. then we can see the hard disk, such as: 5. go to the Linux system and use fdisk-l to see the following effect: sudo fdisk-l. here we can see that/dev/sdb is the newly added hard disk. We need to partition the new hard disk. 1. enter sudo fdisk/dev/sdb on the terminal and type: m. The help information is displayed. Enter: n, add new partition, and enter: p. Select Add primary partition. Type: 1, select the primary Partition Number 1. After the primary partition is created as sdb1, fdsik will let you select the start value and end value of the partition and press enter 2. format the disk. Input mkfs-t ext4/dev/sdb1 in the terminal to format/dev/sdb1 in the ext3 format. Finally, enter w to save all the data and exit, complete the partitioning of the New Hard Disk www.2cto.com 3. create a file in the user's home directory, such as/home/linux/newdisk. Mount the new partition to this directory. 4. Use root permission to open the/etc/fstab file. Adds an option. The specific fstab operation is not explained here. Newly Added:/dev/sdb1/home/linux/newdisk ext4 defaults 0 0 5. restart the system and you will be able to see the hard disk you have loaded. Note: When you enter/home/linux/newdisk to create a file, you may be prompted that the permission is insufficient. solution: sudo chmod 777/home/linux/newdisk.
Author's grassroots teacher

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.