One, add disk
First we add a disk I'm running on an Oracle VM VirtualBox virtual machine and choose to add a new disk when the system shuts down
After adding the disk boot system, we first switch to the root user and the next operation requires root permission to operate.
Input fdisk-l found a new disk with a/dev/sdb of 8G, which I just added.
Second, disk partitioning
Next we partition it, first enter FDISK/DEV/SDB this is equivalent to a boot command in this interface, the user can create partitions,
Operations such as activating partitions, deleting partitions, and viewing partition information. Enter N to create a new partition.
then you can select the partition type, I select P, which is the primary partition. Then the partition number is entered as one of the first primary partitions after the
Select the starting sector of the disk default to 1, directly enter. Then the W write can be partitioned for completion. You need to repeat the above steps more
Re-enter Fdisk-l view
Third, the format of
After partitioning the disk can not be used directly, but also need to format the input mkfs.ext4/dev/sdb1 that is SDB1
Format it and format it as a EXT4 format.
Third, Mount
Next we mount the disk, where I create a new directory mkdir zijian1, mount the disk on that directory
After Mount/dev/sdb1/zijian1, you can enter df-h to view the mount. Use the Umount command to uninstall.
We can use VIM to edit the configuration file so that it can be mounted automatically on each boot.
Vim/etc/fstab Create a new disk with the relevant configuration.
Disk partitioning, formatting and mounting under Linux