Operating Environment | Enviroment
Ubuntu 10.10
One, hard disk partition | Hard disk Add new partition
1, display the hard disk and its own partition situation. Enter the following command in the terminal window:
sudo fdisk-lu
Displays the current hard disk and the owning partition. As shown in the following:
System tip: Disk/dev/sdb doesn ' t contain a valid partition table.
2, partition the hard disk. Enter the following command in the terminal window:
sudo fdisk/dev/sdb
As shown in the following:
Enter M after the command (m for help) prompt to display a helper menu.
After entering N at the command (m for help) prompt, execute the Add a new partition instruction to add another partition to the hard disk.
When the command action appears, enter E, specifying that the partition is an extended partition (extended).
When partition number (1-4) appears, input 1 indicates that only one area is divided.
The subsequent specified starting cylinder face (cylinder) number completes the partition.
Enter p at the command (m for help) prompt to display the partition table.
The system prompts as follows:
Device Boot Start End Blocks Id System
/DEV/SDB1 1 26108 209712478+ 5 Extended
Enter W after the command (m for help) prompt to save the partition table.
System hint: the partition table has been altered!
Enter the following command in the terminal window:
sudo fdisk-lu
As shown in the following:
The system has identified the partition of the hard disk/dev/sdb.
Second, hard disk format | Format hard Disk
1, display the hard disk and its own partition situation. Enter the following command in the terminal window:
sudo mkfs-t ext4/dev/sdb
Description
-T EXT4 indicates that the partition is formatted as a EXT4 file system type.
Note: After formatting is complete, the system has the following prompts:
This filesystem would be automatically checked every mounts or
Whichever comes first. Use Tune2fs-c or-i to override.
Indicates that in order to ensure the integrity of the file system, the file system should be fully inspected every 28 times or every 180 days, and the default values can be adjusted using command tune2fs-c or tune2fs-i.
Three, mount hard disk partition | Mount hard disk partition
1, display the hard drive mount condition. Enter the following command in the terminal window:
sudo df-l
The new hard disk partition is not mounted and cannot be accessed and viewed.
Enter the following command in the terminal window:
sudo mount-t ext4/dev/sdb/devdata
Description
Specifies that the hard disk partition file system type is EXT4, while the/DEV/SDB partition is mounted to the directory/devdata.
Enter the following command again in the terminal window:
sudo df-l
The new hard disk partition is already mounted, such as the bottom red box content.
2. Configure the hard drive to automatically mount on the system boot. Add the following configuration to the file/etc/fstab:
#/devdata was On/dev/sdb
Uuid=37eaa526-5d96-4237-8468-603df5216ce9/devdata EXT4 Defaults 0 3
Appendix 1:fdisk Command Explanation | Appendix Part 1:fdisk Command syntax
The syntax for the FDISK command is as follows:
fdisk [-B sectorsize] Device
Fdisk-l [-u] [device ...]
Fdisk-s partition ...
Fdisk-v
Description
- -B <sectorsize> Specify the size of each partition. You can also execute FDISK device (such as: FDISK/DEV/SDB) After you specify it when prompted.
- -l lists the partition table status for the specified peripheral device. If only fdisk-l is executed, the system lists the known partitions.
- -U is paired with the "-L" parameter list, which replaces the number of cylinders with the number of partitions to represent the starting address of each partition.
- -S <parttion> outputs the size of the specified partition to the standard output, in chunks.
- -V Displays the version information for Fdisk.
Appendix 2:MKFS Command Explanation | Appendix Part 2:MKFS Command syntax
The syntax of the MKFS command is as follows:
MKFS [-v] [-t fstype] [fs-options] Filesys
Description
- -V shows a brief use of the method.
- -T <fstype> specifies what file system to build, such as: Ext3, Ext4.
- FS Specifies the parameters when the file system is established.
- -V Displays version information with detailed usage methods.
Appendix 3:mount Command Explanation | Appendix Part 3:mount Command syntax
The syntax of the MKFS command is as follows:
Mount [-AFFNRSVW] [-t vfstype] [-l label] [-O options] Device dir
Mount [-LHV]
Description
- -A loads all the devices that are set in the file/etc/fstab.
- -F does not physically load the device. Can be used in conjunction with the-v parameter to view the execution of Mount.
- -F must be used in conjunction with the-a parameter. All devices set in/etc/fstab are loaded at the same time to speed up execution.
- -T Vfstype specifies the type of file system to load, such as: Ext3, Ext4.
- -L label specifies a label name for the mount point.
- -L Displays the label of the partition.
- -h Displays help information.
- -V Displays the version information for Mount.
- The partition or file to be mounted by the device. If the device is a file, attach the-o loop parameter when mounting.
- The mount point of the Dir partition.
Appendix 4:fstab Configuration Detailed | Appendix Part 4:fstab Detail Configuration
A total of 6 columns in/etc/fstab:
- File system: Specifies the device name (for example:/DEV/SDB) of the filesystem to be mounted. You can also use Uuid,uuid to specify the device's UUID number by using the Blkid command to view (for example, Blkid/dev/sdb).
- Mount point: Mount points. is to manually create a directory, and then mount the partition to this directory.
- Type: Used to specify the types of file systems. such as: Ext3, EXT4, NTFS and so on.
- Option dump:0 means no backup, and 1 means that you want to back up the contents of the entire <file system>. The recommended setting here is 0.
- Pass: Used to specify how fsck will check the hard disk. 0 means no check, the mount point is partition/(root partition) must be set to 1, the other mount point cannot be set to 1, if there is a mount that is set to a value greater than 1, then after the root partition is checked, and then the value of the pass is checked from small to large, the same value is checked at the same time. such as:/home and/boot pass set to 2,/devdata pass set to 3, then the system checks the root partition, and then check the boot and/home, and then check the/devdata.
Ubuntu-HDD Partitioning, formatting, auto-mount configuration (purely reproduced but test-viable)