Linux disk management and mount

1. vm workstations add disk

 

Restart it after you have added virtual machine

Then fdisk -l

 

You can see the virtual machine has recognized a new disk

 

2. Add the disk partition

input the command

fdisk /dev/sdb

Command (input m to get help): n-
the Partition type:
   P Primary (Primary 1, 0 Extended, Free. 3)
   E Extended
the Select (default P): P
partition number (1-4, default 1):
start sector (1024 -41943039, default is 1024):
the default value 1024
Last sector, sector + or + size {K, M, G} (1024-41943039, default 41943039): # this is the size of the space partition, default full election
will use the default value of 41,943,039
partition 1 has been set for Linux type, size to 19.5 GiB

command (input m to get help): w #w save operation
at the partition the Table has been the Altered!

Calling ioctl () to Re-partition the Read the Table .
Syncing disks.

Then see if the kernel has recognized the new partition:

 cat /proc/partitions

If there is a newly added partition, said the added successfully

If no

You need to manually add

partx -a /dev/<device>

or

partprobe [/dev/device]

In a look at the kernel can

 

3. Format the partition

mkfs -t ext4 /dev/sdb1

 

4. Mount

mount /dev/sdb1 sdb1

 

笔记仅做了一块磁盘一个分区的示例,若有多块磁盘多个分区,多操作上述命令几次就可以了。。

 

Guess you like

Origin www.cnblogs.com/heyaoxin666/p/12301815.html