当前位置:网站首页>Linu foundation - zoning planning and use
Linu foundation - zoning planning and use
2022-06-30 07:02:00 【Passerby_ Wang】
Catalog
3、 ... and 、 Identify partition table
1、 Use mount Command mount partition
6、 ... and 、 View partition usage
1、 Use df Command to check partition usage
7、 ... and 、 Power on auto mount
1、 Writing configuration files /etc/fstab, Realize automatic mount after power on
One 、 Partition management
1、 Disk usage process
Hard disk installation -> Zoning -> format -> Mount the use
Two 、 Zoning
1、MBR Partition mode
1) summary
MBR Is the master boot record (Master Boot Record) English abbreviations , In traditional hard disk partition mode , The boot sector is the first sector of each partition , The primary boot sector is the first sector of the hard disk . In order to facilitate computer access to the hard disk , Divide the space on the hard disk into many blocks ( English name sectors, That's sector ), Then assign an address to each block , Called logical block address .
stay MBR in , The size of the partition table is fixed , A total of... Can be set 4 Primary partitions , perhaps 0~3 Primary partitions +1 Extended partitions (n Logical partitions ), The extended partition cannot be formatted , stay MBR The logical block address in the partition table adopts 32 Bit binary number means , Therefore, a total of... Can be expressed 2^32(2 Of 32 Power ) A logical block address . If a sector size is 512 byte , that MBR The maximum partition capacity of the hard disk is only 2TB.
2) command
fdisk
function : Partition tool
Format :fdisk Hard disk device
Common options
-l View partition table
-s View partition block size
Interactive common options
m List instructions to help
p Look at the existing partition table
n New partition
d Delete partition
q Discard changes and exit
w Save changes and exit
3) example
View all sections
[email protected]:~# fdisk -l # View all sections
Disk /dev/sda: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9f8bacab
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 100665343 100663296 48G 83 Linux
/dev/sda2 100667390 104855551 4188162 2G 5 Extended
/dev/sda5 100667392 104855551 4188160 2G 82 Linux swap / Solaris
Disk /dev/sdb: 20 GiB, 21474836480 bytes, 41943040 sectors #sdb Add a new hard disk , To be partitioned
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesView partition block size
[email protected]:~# fdisk -s /dev/sda1 # View partition block size
50331648Create partitions
[email protected]:~# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x4ec6e610.
Command (m for help):
Command (m for help): n # Create a new partition , Input n Back carriage return
Partition type
p primary (0 primary, 0 extended, 4 free) # create primary partition
e extended (container for logical partitions) # Create extended partition
Select (default p): p
Partition number (1-4, default 1):1 # Set the primary partition number to 1, Input 1 Back carriage return
First sector (2048-41943039, default 2048): # Select the starting sector , Press enter by default
Last sector, +sectors or +size{K,M,G,T,P} (2048-41943039, default 41943039): +10G
# Set partition size , I'm going to set it to 10GBCommand (m for help): p # Print partition table
Disk /dev/sdb: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4ec6e610
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 20973567 20971520 10G 83 Linux
# Newly created partition information Command (m for help): w # Save changes and exit 2、GPT Partition mode
1) summary
GPT yes GUID Partition Table (GUID Partition Table) English abbreviations , meaning “ Globally unique disk partition table ”, Is a physical hard disk partition table structure layout standard . stay GTP The first data block of the disk also has a connection with MBR( Master boot record ) Similar marks , be called PMBR.PMBR The role of is , When used, it does not support GPT When using the partition tool , The entire hard disk will appear as a protected partition , It has its own partition table , namely GPT Partition table .
GPT Partition ratio of MBR More advanced , Because in GPT The maximum number of partitions that can be customized in the partition header , in other words GPT Partition table size is not fixed . Maximum support 128 Primary partitions , The biggest support 18EB disk (1EB=1024 PB=1024 x1024 TB),GPT The logical block address in the partition adopts 64 Bit binary number means , Besides ,GPT The partition has a backup partition table at the end of the hard disk , It ensures that partition information is not easy to lose .
2) command
parted
function : Partition tool
Format :parted Hard disk device
Interactive common options
help View instruction help
mktable msdos | gpt Create the specified schema partition table
mkpart primary File system type
print View partition table
rm Deletes the specified partition
quit Exit the interactive environment
3) example
Create partitions
[email protected]:~# parted /dev/sdc
(parted) mkpart
File system type? [ext2]? ext4 # Select file type
Start? 0% # Specify size or percentage as starting position
End? 10% # Specify size or percentage as end position (parted) print # View partition table
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: sun
Disk Flags:
Number Start End Size File system Flags
1 14MB 2147MB 1933MB ext4(parted) quit # Exit the interactive environment 3、 ... and 、 Identify partition table
1、 summary
When the partition table of the hard disk is changed , The change of partition table shall be notified in time Linux kernel , have access to partprobe command , Identify the new partition table , Or restart the system . Otherwise, the exact device may not be found when accessing the partition .
2、 command
partprobe
function : Tell the kernel to recognize the new partition table
Format :partprobe Hard disk
3、 example
[email protected]:~# partprobe /dev/sdbFour 、 format partition
1、 command
mkfs
function : format partition
Format :mkfs Toolset Partition device path
2、 Common toolsets
mkfs.ext3 Partition device path
mkfs.ext4 Partition device path
mkfs.xfs Partition device path
mkfs.vfat Partition device path
3、 example
format partition , Create file system
[email protected]:~# mkfs.ext4 /dev/sdb1 # Here, select format as ext4 file system
mke2fs 1.42.13 (17-May-2015)
Creating filesystem with 2621440 4k blocks and 655360 inodes
Filesystem UUID: 2ab7bed1-15cd-4209-a862-90f5dbf8740d
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done5、 ... and 、 Mount partition
1、 Use mount Command mount partition
notes : Interested bloggers can pay attention to the following article , In detail
2、 example
[email protected]:~# mkdir /opt/wangwu # Create directory wangwu
[email protected]:~# mount /dev/sdb1 /opt/wangwu
# The formatted partition /dev/sdb1 Mount to /opt/wangwu Catalog 6、 ... and 、 View partition usage
1、 Use df Command to check partition usage
2、 command
df
function : Check the disk space usage of the file system
Format :df [ Options ] [ file ]
3、 Common options
-a List of all file systems
-h Easy to read display
-T Show file system type
4、 example
[email protected]:~# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sdb1 ext4 9.8G 23M 9.2G 1% /opt/wangwu7、 ... and 、 Power on auto mount
1、 Writing configuration files /etc/fstab, Realize automatic mount after power on
notes : Interested bloggers can pay attention to the following article , In detail
2、 example
[email protected]:~# vim /etc/fstab # Modify the configuration file
/dev/sdb1 /opt/wangwu ext4 defaults 0 0
Device path Mount point file type Parameters Backup flag Detection sequence 边栏推荐
- How does the CPU recognize the code?
- Cluster distributed
- Qstring to const char*
- RT thread Kernel Implementation (I): threads and scheduling
- Out of class implementation of member function of class template
- Cmake post makefile:32: * * * missing separator Stop.
- Google Earth Engine(GEE)——墨累全球潮汐湿地变化 v1 (1999-2019) 数据集
- Traverse map
- Servlet principle
- [docsify basic use]
猜你喜欢
随机推荐
Finished product upgrade procedure
Go项目目录结构介绍
Cluster distributed
RT thread Kernel Implementation (III): implementation of idle threads and blocking delay
RT thread migration to s5p4418 (III): static memory pool management
RT thread Kernel Implementation (VI): time slice
RT thread Kernel Implementation (V): timer
RT thread Kernel Implementation (II): critical area, object container
[JSON tutorial] Chapter 1 learning notes
Record common problems: spaces in encodeuricomponent decoding and the use of Schema in third-party apps to invoke apps
[Hot100]10. Regular Expression Matching
GO安装以及配置(1)
freemarker
IDEA import导入的类明明存在,却飘红?
NFS mount
[semidrive source code analysis] [x9 chip startup process] 33 - Analysis of related concepts of display module
[Hot100]10. 正则表达式匹配
vs2019和sql
Deploying web projects using idea
Qdebug small details









