How to mount a new virtual disk in linux

Source: Internet
Author: User
When the disk resources allocated to the virtual machine are insufficient, you need to add a new virtual disk. The following is the mounting procedure, which has been verified: 1. When the instance is shut down, add a disk as needed. 2. View disk # fdisk-l // view the disk information. new information is displayed. & nb
When the disk resources allocated to the virtual machine are insufficient, you need to add a new virtual disk. The following is the mounting procedure, which has been verified: 1. When the instance is shut down, add a disk as needed. 2. View Disk # fdisk-l // view the Disk information. the newly added Disk is displayed, for example, Disk/dev/hdb: 27.9 GB, 27917287424 bytes 3. Partition the new disk # fdisk/dev/hdb (based on your own disk name) Command (m for help): n // parameter n, indicating to create a new partition press enter Command action: e extended // input e to create an extended partition p primary partition (1-4) // input p to create a primary partition input parameter p press enter Partion number (1-4 ): 1 // you can divide up to four primary partitions as needed. Input 1 here, which means to create the First primary partition and press enter First Cylinder (1-1014, default 1 ): 1 // number of disk blocks starting from the first primary partition. you can select the default value 1. press enter Last cylindet or + siza or + sizeM or + sizeK: + 1024 MB // it can be a number in MB or a disk block. Here we enter + MB to indicate that the partition size is 1 GB www. 2cto.com press enter or press enter to create only one partition. by default, press enter to create a partition. if you want to create more partitions, follow the steps above to continue the creation, after all partitions are created, they must be saved. Command (m for help): w // Save the newly created partition and press enter to create the partition. # Fdisk-l // view the created partition. Some partitions may need to be restarted. Format the newly created partition # mkfs-t ext3 (disk type after formatting)-c/dev/hdb1 (disk partition to be formatted) 5. Mount the formatted partition to the desired directory. for example, you can create a new directory in the root directory. # Mkdir test # mount/dev/hdb1/test note: Generally, the mount directory is empty and mounted to the previous partition (accurate to a file system) then we can see what is in that partition. Www.2cto.com but Linux does not force you to mount a file system to an empty directory. if/home is a directory in the root partition/, the subdirectories and files below account for 500 MB, then you mount/dev/hdb1 to/home, so the 500 M file in the original/home will not be seen, instead of the content in the/dev/hdb1 partition. The files are still on the hard disk, but you can't see them and you can't use them until you unmount/home and the original content is displayed again. After mounting the file, you can check whether the file is mounted. # Df-TH/dev/hdb1 ext3 28G 648 M 26G 3%/test // it shows that it has been mounted to the test Directory 6. Enable automatic mounting after the system restarts # vi/etc/fstab and add a sentence/dev/hdb1/test ext3 defaults 1 2. then restart the system and mount it to the test partition automatically. 7. Common df commands are described as follows: Function: view the status information of the Linux file system, and display the capacity, used, unused, and Mount points of each partition. Syntax: df [option]... [file]... parameter description:-a, -- all includes the file system-B with a size of 0 blocks, -- block-size = the size block is measured in-h in bytes of a specified size>, -- human-readable prints out the file system size in an easy-to-understand format (for example, 1 K 234 M 2G)-H, -- si is similar to-h, however, take the power of 1000 instead of 1024-I. -- inodes displays inode information instead of block usage www.2cto.com-k, that is, -- block-size = 1 K-l, -- local only displays the local file system -- no-sync does not perform the sync action before getting the used data (default)-P, -- portability uses the POSIX output format -- sync first performs the sync action-t, -- type = to print only the file system information of the specified type>-T, -- print-type: print the file system type-x, -- exclude-type = type: print only the file system information that is not the specified type>-v (this option is not processed) -- help: displays the help information and leaves. -- version: displays the version information and leaves.
Common operations: df-k displays information about each partition in kilobytes of KB. df-a shows all partitions, including partitions with a size of 0. df-T shows the partition type. The author cao527121128, such as EXT2 or EXT3.
Related Article

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.