Add new hard disks, partitions, and mounts in Linux
After mounting the new hard disk, enter the fdisk-l command to view the current disk information.
We can see that in addition to the current first hard disk, there is also a second hard disk of the sdb, and then partition it with fdisk/dev/sdb.
Enter the fdisk command, enter h to view the help of this command, and partition by n
Here, input e is divided into logical partitions, and p is used as the primary partition. We want to divide this disk into the primary partition, that is, input p to enter the primary partition as the primary partition, because it is a new disk, we input 1 to split the First primary partition First Cylinder to select the number of starting disks for the partition. Here you can customize or choose not. The default value is 1, if you have no special requirements, we strongly recommend that you select the default value, that is, "1" for partitioning (Press enter directly). Next, we will define the size of the partition. If you press the default value (Press ENTER) that is, to use all available storage spaces, or to use numbers ending with M or m units (uppercase M indicates a large B, if the input 1 M is actually X8, that is, 8 m space ), here we split the space into 1 GB first, so after entering + 1024 m, we enter w to write the partition. After the end, we can enter fdisk-l to view the partition we just divided, then use mkfs-t ext3-c/dev/sdb1 for formatting. If there are multiple partitions, you can change sdb1 to sdb2 sdb3... similarly, you can use fdisk-l to see that the blue part of each partition is written to the hard disk volume label, If you do not want the volume label, press Enter. Now that the partition is ready, mount the partition to use it. Here I mount it to the mnt directory, you can also create a directory for mounting to check whether the partition size is the same as the predefined one. Run the df-TH command to check the partition size Currently mounted, see the partition we just divided. If you want to automatically mount the partition every time the system restarts, you can modify the/etc/fstab file, add/dev/sdb1/www ext3 defaults 1 2 (format description: /dev/sdb1 indicates which partition ext3 is the format of this partition. ults indicates the parameter to be set during mounting (read-only, read/write, and quota enabled ), the input parameters include rw, dev, exec, auto, nouser, and async. 1 indicates whether to use dump for recording, and 0 indicates whether to use dump for recording. 2 is the check order at boot, the boot system file is 1, and other file systems are 2, if not checked, it is 0)