current position:Home>418 Linux foundation (partition and directory)

418 Linux foundation (partition and directory)

2022-06-24 09:54:28liufeng2023

1、 Partition

  1. Linux Partition of hard disk It is mainly divided into Primary partition (primary partion) and Extended partitions (extension partion) Two kinds of , The sum of the number of primary and extended partitions cannot be greater than four .
  2. The primary partition can be used immediately but can no longer be partitioned .
  3. The extended partition must be partitioned twice before it can be used , After the secondary partition of the extended partition , It's called logical partitioning (logical partion), There is no limit on the number of logical partitions .

2、 Disk files

Linux A hard disk in a is a file , Deposit /dev Below directory ,IDE Hard disk named hdx(x For from a—d, General computer IDE Up to four hard disks ). SCSI,SATA,USB Hard disk, etc. , stay /dev/ The directory is named sdx(x by a—z)

such as SCSI Hard disk , The primary partition is from sda1 Start to sda4, Logical partition from sda5 Start ,( Logical partitions are always from sda5 Start …)

The device name can use fdisk –l see :

sudo fdisk ‐l

Output :

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders, total 83886080 sectors
Units =  A sector  of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e626e
 equipment   start-up   The starting point   End   Number of blocks  Id  System 
/dev/sda1 * 2048 81788927 40893440 83 Linux
/dev/sda2 81790974 83884031 1046529 5  Expand 
/dev/sda5 81790976 83884031 1046528 82 Linux  In exchange for  /

You can see the hard disk file /dev/sda The size is 42.9G, And it is divided into a primary partition /dev/sda1, An extended partition /dev/sda2, The extended partition is divided into a logical partition /dev/sda5.

3、 Directory structure

Linux The tree structure directory is used in .
 Insert picture description here

/ # root directory 
/bin # The commands required by the underlying system are located in this directory , It's the command that the smallest system needs , Such as :ls, cp, cd wait . The files in this directory are executable , General users can use it .
/dev # Device file , Like sound cards 、 disk 、 mouse 、 Keyboard, etc .
/etc # System management and configuration files 
/etc/init.d # Launch configuration files and scripts , You can add a startup script here .
/etc/rc.local # User added startup item 

/home # User home directory , Such as user user The home directory of /home/user, It can be used ~user Express 
/lib # Standard programming inventory placement path , Also called dynamic link sharing library , Works in a similar way windows Inside .dll file 
/sbin # Super management order , Here is the storage of the system administrator using the management procedures .
/tmp # Temporary file directory , Sometimes when users run programs , Temporary files will be generated . /tmp Used to store temporary files .
/root # Home directory of system administrator 
/mnt # Used to temporarily mount other file systems 
/lost+found # This directory is usually empty , Unexpected system crash or unexpected machine shutdown , And generate some file fragments here . When the system starts 
 In the process of moving fsck The tool will check here , And fix the damaged file system .
/media # The mount point of plug and play storage device is automatically created in this directory , such as USB After the disk system is automatically mounted , Will be in 
 A directory is generated under this directory 
/proc # Virtual file directory , You can directly access this directory to get system information .
/var # Login files or error message files for all services (log files) All in  /var/log  Inside 
/boot # contain Linux Files required by kernel and system boot program , such as  vmlinuz initrd.img  The files are located in this directory . In one 
 In general ,GRUB or LILO The system boot manager is also located in this directory ;

/usr # The largest catalog , Almost all the applications and files to be used are in this directory , It includes :
	/usr/bin # Lots of applications 
	/usr/sbin # Some hypervisors for super users 
	/usr/include #Linux Under the development and compilation of the application required header files 
	/usr/lib # Common dynamic link libraries 
	/usr/share/man # Help document 
	/usr/src # Source code ,Linux The source code of the kernel is in /usr/src/Linux in 
	/usr/local/bin # Local added orders 
	/usr/local/lib # Locally added library root file system 

 Insert picture description here

  • . Represents the current path .
  • .. On behalf of the previous Directory .
  • ~ Represents the user directory path .

copyright notice
author[liufeng2023],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/175/202206240907452889.html

Random recommended