The steps to add a hard drive to a virtual machine are a little more nonsense, mainly listing a few detailed steps to set up after adding a hard drive:
1. View disk information : Fdisk-ls
Before adding as shown:
After adding as:
can also be used: ls/dev/sd* view, such as:
2. Disk partitioning :
After disk recognition is successful, partition with the Gdisk command: GDISK/DEV/SDB
After executing, enter the interactive command line of Gdisk, enter p, and then you can see the hard disk details, as shown in:
If you create multiple partitions, use the Create PARTITION command n, enter a carriage return, select the partition number (default starting from 1), enter 1, return
I only set a default partition 100G here, if you need to set two partitions, in "Last Sector (2048-419430366, default = 419430366) or {+-}SIZE{KMGTP}:" After you want to enter the size of the first partition, such as: +50g, and then divide the remaining partitions.
3. Format the disk partition : Mkfs.xfs/dev/sdb or mkfs-t xfs/dev/sdb, such as:
If multiple partitions are formatted using the command above
4. Mount the disk partition :
Create a folder in the root directory data, such as:
Mount to the Data directory: Mount/dev/sdb/data, view mount information: Df-h, such as:
5. Set power on auto Mount , open auto mount file: Vi/etc/fstab, add line as shown:
Save exit, reboot the host to see if it is automatically mounted: DF-LH
Linux system Add new hard disk, and partition settings start auto mount, graphics Tutorial!