Linux mount disk & kuoron

1, adding a disk

Direct physical server plug hard disk, but the virtual machine, then added directly to disk can be, can not understand their own Baidu, it is relatively simple.

2, manage disk partitions, fdisk command.

In the Linux system, manage disk device most commonly used method will undoubtedly fdisk commands. fdisk command is used to manage disk partition, format is "fdisk [disk name]", which provides a set of add, delete, convert the partition functions in a "one-stop service partition." However, with the foregoing explanation of different written directly behind the command parameters, the parameters of this command (see Table 6-5) is interactive, it is particularly convenient when the hard disk device management, can be dynamically adjusted according to demand.

We first try to manage / dev / vdb hard disk device using fdisk command. After seeing the message input parameter p to view existing hard disk partition information device, which comprises the capacity size information, sector number of a hard disk:

 Input parameters n try to add a new partition. You will be asked to choose to continue to enter parameter p to create a primary partition, or e input parameters to create an extended partition. Here the input parameter p to create a primary partition:

After confirming create a primary partition, the system requires you to enter the number of primary partitions. We know the foregoing, the primary partition number ranges from 1 to 4, the input here can be a default one. The next sector will be prompted to define the starting position, which does not require changes, we hit ENTER to retain the default settings, the system will automatically calculate the position of the most forward of spare sectors. Finally, end sector will be asked to define the location of the partition, which is actually going to define the size of the entire partition is. We do not have to calculate the number of sectors, here is added by the default configuration, the entire disk to partition 1; also can customize the need to create a hard disk partition. Linux, Windows partition number is equivalent to the inside of the C, D as the drive letter.

Use parameter p again to view disk partition information device. And she can see a name of / dev / vdb1, starting sector position 2048, ending sector position 20971519 of the primary partition. This time do not close the window, 

 And after hitting parameter w should enter, so that the partition information is the real success write it. 

 After the above steps are finished, Linux system will automatically put the primary hard disk partition abstracted / dev / sdb1 device file. We can use the file command to view the file's properties, sometimes the system does not automatically sync to the Linux kernel partition information, and this situation seems to be relatively common (but not count as a serious bug). We can enter commands manually partition information partprobe synchronized to the kernel, and is generally recommended continuously execute the command twice, the effect will be better. If you use this command can not solve the problem, then restart the computer now, the killer one hundred test Braun, there will be used. 

 If the hardware storage device is not formatted, the Linux system can not know how to write data on it. Thus, after the partition of the storage device required for formatting. Formatting operation command in the Linux system is mkfs. This command is very interesting, because the input name mkfs before hitting the Tab key twice in order for the filled Shell terminal, the effect will be shown as follows: 

The mkfs command is very close to the common file system name with the suffix saving way into multiple command file, using them is very simple -. Mkfs file type name. For example, to format the partition for the XFS file system, the command should be mkfs.xfs / dev / vdb1

Finally completed the partitioning and formatting operation of the storage device, the next step is to mount the storage and use of the device. Associated with very simple steps: First, create a directory for the mount point to mount the device; then use the mount command to the storage device and associate mount points; last used df -h command to view the status and mount hard disk usage information. 

 

 

 

 

 

 

 

Part of this article is derived from "Linux in respect of such a study."

Guess you like

Origin www.cnblogs.com/leeqizhi/p/12076719.html