Linux using fdisk tool SSH command line partition and mount using partition tutorial

  
 

Under the Linux partition is more troublesome, the more convenient tool is called fdisk

We can use this tool to freely add and delete partitions. The following is to use it to add partitions and mount partitions.Tutorial


Adding a partition

Before adding a partition, we must first look at the current partition details of this computer, run the following command
Shell 1 fdisk -l

You will get the disk details on your computer:



For example, we have to partition the 42.9GB disk above. Then first record its address in front of the disk size, such as /dev/sdb

of the disk, then enter the following command
Shell 1 fdisk disk address

you will receive a warning, Enter n



and then lose Enter a new partition into p, you will receive a prompt to enter the disk number, enter 1, and then select the start sector and the end sector, if the disk is divided into only one partition can directly keep the default, otherwise you can calculate the fan Area input data



The last input w saves the changes, and the partition of the disk is complete!

Format Partition

A partition must be formatted to be used normally after its creation. The formatted command is as follows:
PHP
1 mkfs -t ext3 Disk address

After entering the command, the system will automatically complete the formatting operation on the partition



mounting the partition

Having a partition under Linux is not possible Directly used, we also need to mount the partition

The meaning of the mount is probably to map the disk to a folder, reading and writing this folder is equivalent to reading and writing the disk
PHP 1 mount disk address mapping address

For example, if we want to map the above disk to the /mnt/disk1 directory, we need to run the following command



After the operation is complete, access the /mnt/disk1 directory to complete the Access zones friends

Copyright © Windows knowledge All Rights Reserved