This article is a mirror article of machine translation, please click here to jump to the original article.

View: 14165|Reply: 2

[linux] Centos 7 Mounting Data Disk Tutorial

[Copy link]
Posted on 7/6/2018 2:21:50 PM | | | |
A Centos 7 server purchased from Alibaba Cloud was not enough disk space.I bought a new 100G hard drive, execute the order

Query the usage of data disks of less than 100G, as shown in the figure below:



Execute the "fdisk -l" command and find that there is a 100G hard drive. If the command is executed,/dev/vdb is not found, which means that your instance has no data disks, there is no need to format the data disk, please ignore the rest of this article. As shown below:



Create a single-partition data disk

Execute the following commands in turn:
Run fdisk /dev/vdb: Partition the data disk.
Type n and press enter: Create a new partition.
Enter p and press enter: Select the primary partition. Since you are creating a single-partition data disk, you only need to create a primary partition.


Enter the partition number and press enter. Because here only one partition is created, you can enter 1
Enter the first available sector number: press enter to take the default value (just enter)
Enter the last sector number: Since only one partition is created here, press enter to take the default value. (Just enter)
Type WQ and press enter to start partitioning.

[root@xx~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x7b268fc0.

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-209715199, default 2048): 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199):
Using default value 209715199
Partition 1 of type Linux and of size 100 GiB is set

Command (m for help): wq
The partition table has been altered!

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




View the new partition: Run the command fdisk -l. If the following message appears, a new partition /dev/vdb1 has been successfully created.

[root@xx~]# fdisk -l

Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0008d73a

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    83884031    41940992   83  Linux

Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x7b268fc0

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048   209715199   104856576   83  Linux





Create a file system on the new partition: run the command mkfs.ext3 /dev/vdb1.
This example creates an ext3 file system. You can also choose to create other file systems according to your needs, for example, if you need to share files between Linux, Windows, and Mac systems, you can use mkfs.vfat to create a VFAT file system.
The time it takes to create a file system depends on the disk size.




(Recommended) Backup etc/fstab: Run the command cp /etc/fstab /etc/fstab.bak (optional)

Write the new partition information to /etc/fstab: run the command echo /dev/vdb1 /mnt ext3 defaults 0 0 >> /etc/fstab

If you need to mount the data disk separately to a certain folder, such as for storing web pages separately,Replace the above command /mnt with the desired mount point path

View the new partition information in /etc/fstab: Run the command cat /etc/fstab

Mount the file system: Run the command mount /dev/vdb1 /mnt.
(Note: To mount the mnt directory, you need to create the folder first!) )

To view the current disk space and usage: Run the command df -h. If the message "Create a new file system" appears, it means that the mount is successful and the new file system can be used.
After the mount operation is complete, you do not need to restart the instance to start using the new file system.




(End)




Previous:404 pages for pure HTML5 CSS3 implementation
Next:Google AMP and Baidu MIP knowledge popularization
 Landlord| Posted on 12/27/2021 10:55:51 PM |
# Temporary mounting

# Write this line at the bottom of /etc/fstab
 Landlord| Posted on 12/28/2021 10:30:14 PM |
ESXI virtual machine expands the disk capacity of Linux system
https://www.itsvse.com/thread-10217-1-1.html
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com