search

dev/hda5 represents the logical partition of the main disk on the IDE0 interface in Linux. All Linux devices are represented as a file in the "/dev" directory, and the devices starting with "hd" in the ".dev" directory are IDE hard disks. The third letter in the device name is a, which represents the first hard disk (also known as the primary disk); the partition is represented by a number. The numbers 1 to 4 are used to represent the primary partition or extended partition. The number of the logical partition starts from 5. .

What does dev/hda5 mean in linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

dev/hda5 in Linux represents the logical partition of the main disk on the IDE0 interface.

All devices in Linux are represented as a file in the /dev directory. Devices starting with "hd" in the .dev directory are IDE hard disks, and devices starting with "sd" are SCSI hard disks.

The third letter in the device name is a, which means the first hard disk (also becomes the master disk), and b means the second hard disk (also becomes the slave disk).

Partitions are represented by numbers. The numbers 1 to 4 are used to represent primary partitions or extended partitions. The number of logical partitions starts from 5. The primary partition of the main disk on the IDE0 interface is called /dev/hda1; and /dev/hda2 represents the extended partition of the main disk on the IDE0 interface; the first logical partition of the main disk on the IDE0 interface is called /dev/hda5

linux logical partition

When we need more partitions, we need to give up one of the primary partitions. Generally, after creating three primary partitions, the fourth A partition is divided into an extended partition, and the extended partition is divided into several logical partitions for use.

1. Demonstrate the effect of creating four primary partitions

1) Create four partitions (See the previous article for specific steps)

//进入分区工具
[root@localhost ~]# fdisk /dev/sdb
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。


命令(输入 m 获取帮助):n
Partition type:
   p   primary (3 primary, 0 extended, 1 free)
   e   extended
Select (default e): p
已选择分区 4
起始 扇区 (5015552-10485759,默认为 5015552):
将使用默认值 5015552
Last 扇区, +扇区 or +size{K,M,G} (5015552-10485759,默认为 10485759):
将使用默认值 10485759
分区 4 已设置为 Linux 类型,大小设为 2.6 GiB

命令(输入 m 获取帮助):w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
正在同步磁盘。

2) Try to create a fifth partition

[root@localhost ~]# fdisk /dev/sdb
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

//创建第五个分区提示需要放弃一个主分区创建一个扩展分区
命令(输入 m 获取帮助):n
If you want to create more than four partitions, you must replace a
primary partition with an extended partition first.

命令(输入 m 获取帮助):p    //展示分区表

磁盘 /dev/sdb:5368 MB, 5368709120 字节,10485760 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x6928af85

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     4196351     2097152   83  Linux
/dev/sdb2         4196352     4605951      204800   83  Linux
/dev/sdb3         4605952     5015551      204800   83  Linux
/dev/sdb4         5015552    10485759     2735104   83  Linux

命令(输入 m 获取帮助):

3) Delete the fourth primary partition and divide it into extended partition

命令(输入 m 获取帮助):d        //输入d删除分区
分区号 (1-4,默认 4):4        //选择删除4号分区
分区 4 已删除

命令(输入 m 获取帮助):n        //现在可以创建分区了
Partition type:
   p   primary (3 primary, 0 extended, 1 free)
   e   extended
Select (default e): e                //选择创建扩展分区
已选择分区 4                            //自动选择最后4号分区
起始 扇区 (5015552-10485759,默认为 5015552):    
将使用默认值 5015552
//直接回车表示将剩余所有空间分给扩展分区
Last 扇区, +扇区 or +size{K,M,G} (5015552-10485759,默认为 10485759): 
将使用默认值 10485759    
分区 4 已设置为 Extended 类型,大小设为 2.6 GiB

命令(输入 m 获取帮助):p

磁盘 /dev/sdb:5368 MB, 5368709120 字节,10485760 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x6928af85

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     4196351     2097152   83  Linux
/dev/sdb2         4196352     4605951      204800   83  Linux
/dev/sdb3         4605952     5015551      204800   83  Linux
/dev/sdb4         5015552    10485759     2735104    5  Extended

命令(输入 m 获取帮助):

You can see sdb4 in the partition table The type is extended (extended partition). Extended partitions cannot store data. To use them, you need to divide them into several logical partitions. There is no limit on the number of logical partitions.

4) Create a logical partition

命令(输入 m 获取帮助):n            //创建分区
All primary partitions are in use
添加逻辑分区 5                            //默认直接创建5号逻辑分区
起始 扇区 (5017600-10485759,默认为 5017600):
将使用默认值 5017600
Last 扇区, +扇区 or +size{K,M,G} (5017600-10485759,默认为 10485759):+200M  //大小设置200M
分区 5 已设置为 Linux 类型,大小设为 200 MiB

命令(输入 m 获取帮助):p            //查看分区表

磁盘 /dev/sdb:5368 MB, 5368709120 字节,10485760 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x6928af85

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     4196351     2097152   83  Linux
/dev/sdb2         4196352     4605951      204800   83  Linux
/dev/sdb3         4605952     5015551      204800   83  Linux
/dev/sdb4         5015552    10485759     2735104    5  Extended
/dev/sdb5         5017600     5427199      204800   83  Linux         //逻辑分区创建成功

命令(输入 m 获取帮助):n                //继续创建分区
All primary partitions are in use
添加逻辑分区 6                            //默认添加逻辑分区
起始 扇区 (5429248-10485759,默认为 5429248):
将使用默认值 5429248
Last 扇区, +扇区 or +size{K,M,G} (5429248-10485759,默认为 10485759)://将剩余空间全分配给6号逻辑分区
将使用默认值 10485759
分区 6 已设置为 Linux 类型,大小设为 2.4 GiB

命令(输入 m 获取帮助):p            //查看分区表

磁盘 /dev/sdb:5368 MB, 5368709120 字节,10485760 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x6928af85

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     4196351     2097152   83  Linux
/dev/sdb2         4196352     4605951      204800   83  Linux
/dev/sdb3         4605952     5015551      204800   83  Linux
/dev/sdb4         5015552    10485759     2735104    5  Extended
/dev/sdb5         5017600     5427199      204800   83  Linux
/dev/sdb6         5429248    10485759     2528256   83  Linux

命令(输入 m 获取帮助):w        //保存分区
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
正在同步磁盘。
[root@localhost ~]#

2. Refresh the partition table , format, and mount

What we are talking about here are temporary mounts. Restarting the computer will not have mount information. It is just for the convenience of learning and understanding the disk. It is permanent. Mounting requires the uninstallation of the mount command to be written in etc/fstab, which will be discussed later.

As in the previous article, refresh and format the partition table, create a folder to be mounted, and mount the partition to the specified folder.

Note: Extended partitions cannot be mounted, only logical partitions divided by them can be mounted.

//1、刷新分区表
//直接查看分区表,发现刚刚创建的分区没有显示出来。
[root@localhost ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk 
├─sda1            8:1    0 1000M  0 part /boot
└─sda2            8:2    0   19G  0 part 
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0    5G  0 disk 
├─sdb1            8:17   0    2G  0 part 
├─sdb2            8:18   0  200M  0 part /mnt/disk2
└─sdb3            8:19   0  200M  0 part /mnt/fisk3
sdc               8:32   0    5G  0 disk 
sdd               8:48   0    5G  0 disk 
sde               8:64   0    5G  0 disk 
sdf               8:80   0    5G  0 disk 
sdg               8:96   0    5G  0 disk 
sdh               8:112  0    5G  0 disk 
sdi               8:128  0    5G  0 disk 
sr0              11:0    1  4.4G  0 rom  /run/media/root/CentOS 7 x86_64
//刷新分区表
[root@localhost ~]# partprobe /dev/sdb
//刷新之后查看分区表,发现刚刚创建的所有分区都显示出来了
[root@localhost ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk 
├─sda1            8:1    0 1000M  0 part /boot
└─sda2            8:2    0   19G  0 part 
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0    5G  0 disk 
├─sdb1            8:17   0    2G  0 part 
├─sdb2            8:18   0  200M  0 part /mnt/disk2
├─sdb3            8:19   0  200M  0 part /mnt/fisk3
├─sdb4            8:20   0  512B  0 part 
├─sdb5            8:21   0  200M  0 part 
└─sdb6            8:22   0  2.4G  0 part 
sdc               8:32   0    5G  0 disk 
sdd               8:48   0    5G  0 disk 
sde               8:64   0    5G  0 disk 
sdf               8:80   0    5G  0 disk 
sdg               8:96   0    5G  0 disk 
sdh               8:112  0    5G  0 disk 
sdi               8:128  0    5G  0 disk 
sr0              11:0    1  4.4G  0 rom  /run/media/root/CentOS 7 x86_64
//2、格式化
//格式化sbd5和sdb6,用分号隔开直接运行两个命令。
[root@localhost ~]# mkfs.ext4 /dev/sdb5;mkfs.ext4  /dev/sdb6
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=1024 (log=0)
分块大小=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
51200 inodes, 204800 blocks
10240 blocks (5.00%) reserved for the super user
第一个数据块=1
Maximum filesystem blocks=33816576
25 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks: 
	8193, 24577, 40961, 57345, 73729

Allocating group tables: 完成                            
正在写入inode表: 完成                            
Creating journal (4096 blocks): 完成
Writing superblocks and filesystem accounting information: 完成 

mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
158080 inodes, 632064 blocks
31603 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=648019968
20 block groups
32768 blocks per group, 32768 fragments per group
7904 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912

Allocating group tables: 完成                            
正在写入inode表: 完成                            
Creating journal (16384 blocks): 完成
Writing superblocks and filesystem accounting information: 完成 
//3、挂载
//创建disk5和disk6文件夹
[root@localhost ~]# mkdir /mnt/disk5 /mnt/disk6
//将sdb5挂载到disk5,将sdb6挂载到disk6
[root@localhost ~]# mount -t ext4  /dev/sdb5 /mnt/disk5 ;mount -t ext4  /dev/sdb6 /mnt/disk6
//查看挂载信息
[root@localhost ~]# df -hT
文件系统                类型      容量  已用  可用 已用% 挂载点
devtmpfs                devtmpfs  470M     0  470M    0% /dev
tmpfs                   tmpfs     487M     0  487M    0% /dev/shm
tmpfs                   tmpfs     487M  8.6M  478M    2% /run
tmpfs                   tmpfs     487M     0  487M    0% /sys/fs/cgroup
/dev/mapper/centos-root xfs        18G  4.2G   13G   25% /
/dev/sda1               xfs       997M  172M  826M   18% /boot
tmpfs                   tmpfs      98M   24K   98M    1% /run/user/0
/dev/sr0                iso9660   4.4G  4.4G     0  100% /run/media/root/CentOS 7 x86_64
/dev/sdb2               ext4      190M  1.6M  175M    1% /mnt/disk2
/dev/sdb3               ext4      190M  1.6M  175M    1% /mnt/fisk3
/dev/sdb5               ext4      190M  1.6M  175M    1% /mnt/disk5
/dev/sdb6               ext4      2.4G  7.3M  2.2G    1% /mnt/disk6
//挂载成功

3. Uninstall (cancel partition mounting)

Command: umount /dev/Partition that needs to be unmounted

[root@localhost ~]# df -hT
文件系统                类型      容量  已用  可用 已用% 挂载点
devtmpfs                devtmpfs  470M     0  470M    0% /dev
tmpfs                   tmpfs     487M     0  487M    0% /dev/shm
tmpfs                   tmpfs     487M  8.6M  478M    2% /run
tmpfs                   tmpfs     487M     0  487M    0% /sys/fs/cgroup
/dev/mapper/centos-root xfs        18G  4.2G   13G   25% /
/dev/sda1               xfs       997M  172M  826M   18% /boot
tmpfs                   tmpfs      98M   24K   98M    1% /run/user/0
/dev/sr0                iso9660   4.4G  4.4G     0  100% /run/media/root/CentOS 7 x86_64
/dev/sdb2               ext4      190M  1.6M  175M    1% /mnt/disk2
/dev/sdb3               ext4      190M  1.6M  175M    1% /mnt/fisk3
/dev/sdb5               ext4      190M  1.6M  175M    1% /mnt/disk5
/dev/sdb6               ext4      2.4G  7.3M  2.2     1% /mnt/disk6
[root@localhost ~]# umont  /dev/sdb6        //取消sbd6挂载
[root@localhost ~]# df -hT        //查看挂载信息,没有sbd6的挂载信息了
文件系统                类型      容量  已用  可用 已用% 挂载点
devtmpfs                devtmpfs  470M     0  470M    0% /dev
tmpfs                   tmpfs     487M     0  487M    0% /dev/shm
tmpfs                   tmpfs     487M  8.6M  478M    2% /run
tmpfs                   tmpfs     487M     0  487M    0% /sys/fs/cgroup
/dev/mapper/centos-root xfs        18G  4.2G   13G   25% /
/dev/sda1               xfs       997M  172M  826M   18% /boot
tmpfs                   tmpfs      98M   24K   98M    1% /run/user/0
/dev/sr0                iso9660   4.4G  4.4G     0  100% /run/media/root/CentOS 7 x86_64
/dev/sdb2               ext4      190M  1.6M  175M    1% /mnt/disk2
/dev/sdb3               ext4      190M  1.6M  175M    1% /mnt/fisk3
/dev/sdb5               ext4      190M  1.6M  175M    1% /mnt/disk5

Canceling the mount is equivalent to unplugging the U disk. For example, I just canceled it When sdb5 is mounted on disk5, it is equivalent to unplugging the U disk of sdb5. The files originally stored in disk5 will disappear, because those files are stored in sdb5. I unplugged the U disk. Naturally, these The files are gone and when sdb5 is remounted, the files will be restored.

Summary

# Mounting is the same as the primary partition at that time. The only difference is that multiple logical partitions can be created. Special attention is that extended partitions cannot be mounted and data cannot be stored. Logical partitions need to be divided for use. This article The article mainly divides logical partitions.

Related recommendations: "

Linux Video Tutorial"

The above is the detailed content of What does dev/hda5 mean in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Linux Operations: Utilizing the Maintenance ModeLinux Operations: Utilizing the Maintenance ModeApr 19, 2025 am 12:08 AM

Linux maintenance mode can be entered through the GRUB menu. The specific steps are: 1) Select the kernel in the GRUB menu and press 'e' to edit, 2) Add 'single' or '1' at the end of the 'linux' line, 3) Press Ctrl X to start. Maintenance mode provides a secure environment for tasks such as system repair, password reset and system upgrade.

Linux: How to Enter Recovery Mode (and Maintenance)Linux: How to Enter Recovery Mode (and Maintenance)Apr 18, 2025 am 12:05 AM

The steps to enter Linux recovery mode are: 1. Restart the system and press the specific key to enter the GRUB menu; 2. Select the option with (recoverymode); 3. Select the operation in the recovery mode menu, such as fsck or root. Recovery mode allows you to start the system in single-user mode, perform file system checks and repairs, edit configuration files, and other operations to help solve system problems.

Linux's Essential Components: Explained for BeginnersLinux's Essential Components: Explained for BeginnersApr 17, 2025 am 12:08 AM

The core components of Linux include the kernel, file system, shell and common tools. 1. The kernel manages hardware resources and provides basic services. 2. The file system organizes and stores data. 3. Shell is the interface for users to interact with the system. 4. Common tools help complete daily tasks.

Linux: A Look at Its Fundamental StructureLinux: A Look at Its Fundamental StructureApr 16, 2025 am 12:01 AM

The basic structure of Linux includes the kernel, file system, and shell. 1) Kernel management hardware resources and use uname-r to view the version. 2) The EXT4 file system supports large files and logs and is created using mkfs.ext4. 3) Shell provides command line interaction such as Bash, and lists files using ls-l.

Linux Operations: System Administration and MaintenanceLinux Operations: System Administration and MaintenanceApr 15, 2025 am 12:10 AM

The key steps in Linux system management and maintenance include: 1) Master the basic knowledge, such as file system structure and user management; 2) Carry out system monitoring and resource management, use top, htop and other tools; 3) Use system logs to troubleshoot, use journalctl and other tools; 4) Write automated scripts and task scheduling, use cron tools; 5) implement security management and protection, configure firewalls through iptables; 6) Carry out performance optimization and best practices, adjust kernel parameters and develop good habits.

Understanding Linux's Maintenance Mode: The EssentialsUnderstanding Linux's Maintenance Mode: The EssentialsApr 14, 2025 am 12:04 AM

Linux maintenance mode is entered by adding init=/bin/bash or single parameters at startup. 1. Enter maintenance mode: Edit the GRUB menu and add startup parameters. 2. Remount the file system to read and write mode: mount-oremount,rw/. 3. Repair the file system: Use the fsck command, such as fsck/dev/sda1. 4. Back up the data and operate with caution to avoid data loss.

How Debian improves Hadoop data processing speedHow Debian improves Hadoop data processing speedApr 13, 2025 am 11:54 AM

This article discusses how to improve Hadoop data processing efficiency on Debian systems. Optimization strategies cover hardware upgrades, operating system parameter adjustments, Hadoop configuration modifications, and the use of efficient algorithms and tools. 1. Hardware resource strengthening ensures that all nodes have consistent hardware configurations, especially paying attention to CPU, memory and network equipment performance. Choosing high-performance hardware components is essential to improve overall processing speed. 2. Operating system tunes file descriptors and network connections: Modify the /etc/security/limits.conf file to increase the upper limit of file descriptors and network connections allowed to be opened at the same time by the system. JVM parameter adjustment: Adjust in hadoop-env.sh file

How to learn Debian syslogHow to learn Debian syslogApr 13, 2025 am 11:51 AM

This guide will guide you to learn how to use Syslog in Debian systems. Syslog is a key service in Linux systems for logging system and application log messages. It helps administrators monitor and analyze system activity to quickly identify and resolve problems. 1. Basic knowledge of Syslog The core functions of Syslog include: centrally collecting and managing log messages; supporting multiple log output formats and target locations (such as files or networks); providing real-time log viewing and filtering functions. 2. Install and configure Syslog (using Rsyslog) The Debian system uses Rsyslog by default. You can install it with the following command: sudoaptupdatesud

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment