I. Partitioning and formatting principles
Ii. Use fdisk partitions in Linux
3. Use mkfs to create a file system
4. Hard Disk Partition mounting;
I. partition principle
1. Primary Partition Table (64 bytes): records the number of start and end columns and primary partitions. The size of the primary partition is limited and cannot exceed four.
2. Extended partitions: change a primary partition to an extended partition. The extended partition supports unlimited partitions (logical partitions). Information about the logical partitions is written in the extended partition table.
Ii. Formatting principles
That is, create different file systems for data storage and reading.
Common LINUX partition tools: fdisk, sfdisk, diskdruid
Fdisk usage
1. Run the command: # fdisk/dev/hdx
2. Add/delete/modify partitions
3. restart the computer. (The partition table information is read by the kernel)
[Root @ server root] # fdisk/dev/hda
The number of cylinders for this disk is set to 9729.
There is nothing wrong with that, but this is larger than 1024,
And coshould in certain setups cause problems:
1) software that runs at boot time (e.g., old versions of lilo)
2) booting and partitioning software from other OSS
(E.g., DOS fdisk, OS/2 fdisk)
command (M for help ): m
command action
A toggle a bootable flag
B edit BSD disklabel
C toggle the DOS compatibility flag
D delete a partition
l List known partition types
M print this menu
N Add a new partition
o create a new empty DOS partition table
P print the Partition Table
q quit without saving changes
S create a new empty sun disklabel
T change a partition's System ID # change the system id
U change display/entry units
V verify the Partition Table
W write table to disk and exit
X extra functionality (experts only)
Command (M for help ):
Iii. Linux formatting Tool
Mkfs-supports ext2, ext3 (log), vfat, msdos, JFS, and reiserfs.
Usage 1: mkfs-T <fstype> <partition>
Example: # mkfs-T ext3/dev/hda1
Usage 2: mkfs. <fstype> <partition>
Example: # mkfs. vfat/dev/hda2
Mke2fs-supports ext2/ext3 file systems
Usage: mke2fs [-J] <partition>
Example: # mke2fs-J/dev/hdb2
4. Hard Disk Partition mounting
1. mount command: # Mount (temporary mounting, system restart is invalid)
Example: # Mount/dev/hda11/mnt/D2
2. Uninstall the command: # umount
Example: umount/dev/hda11
3. Write/etc/fstab (automatic mounting at system startup)
/Dev/hda11/mnt/D2/ext3 defaults 0 0
5. Use the volume label for mounting
1. Add a volume label -- e2label
Example: # e2label/dev/hda10 Test
2. Mount according to the volume label
Example: # Mount label = test/mnt/d1
3. Write/etc/fstab
Label = test/mnt/D1/ext3 defaults 0 0
6. ext2/ext3 mounting options
1. ro/RW -- Read-Only/read/write
2. exec/noexec -- allow/disallow execution
3, dev/nodev -- allow/disallow Device Files
4. SUID, SGID/nosuid/nosgid -- allow/disallow SUID, SGID File
5. atime/noatime -- Update/do not update node access time
6. async/Sync -- asynchronous/Synchronous disk I/O
7, user/nouser -- allow/disallow general users to attach disks, used for options in the/etc/fstable file