Linux标准磁盘分区

本文介绍了Linux中磁盘的命名规则,包括IDE、hd、SATA/SCSI、sd等,并详细讲解了磁盘分区的原理,如主分区、扩展分区和逻辑分区的限制。同时,文章列出了常用的基础命令,如df、fdisk、partprobe、mkfs.ext4等,用于查看和管理磁盘分区。此外,还涵盖了磁盘格式化、临时挂载、开机自动挂载等操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、磁盘
在这里插入图片描述
Linux里面硬盘根据硬盘接口的不同来命名:IDE、hd(a-d)、SATA/SCSI、sd(a-z)
一块磁盘默认可以被分为4个分区,这四个分区分别为主分区或扩展分区,在扩展分区上可以创建逻辑分区。最多只能有4个分区(一般为3个主分区和1个扩展分区)。
boot loader 开机管理程序:初始化硬件

2、基础命令
df -h 查看分区列表
fdisk -l 查看分区列表
partprobe 将分区信息加载到内核
mkfs.ext4 /dev/sda4 添加文件系统,即磁盘格式化
临时挂载:mount /dev/sda4 挂载点目录
mount 查看所有挂载的信息
mount -a 更新挂载点信息
卸载:umount /dev/sda4 或 umount 挂载点目录

[root@localhost Desktop]# fdisk -l

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors					#新添加的一块10G硬盘sdb
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sda: 64.4 GB, 64424509440 bytes, 125829120 sectors				#原来的硬盘sda
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0001e85f

   Device Boot      Start         End      Blocks   Id  System				#磁盘的分区情况
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200    52447231    25174016   8e  Linux LVM

Disk /dev/mapper/rhel-root: 21.5 GB, 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


Disk /dev/mapper/rhel-swap: 4294 MB, 4294967296 bytes, 8388608 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

3、磁盘分区

[root@localhost ~]# fdisk /dev/sdb 
Welcome to fdisk (util-linux 2.23.2).

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
Building a new DOS disklabel with disk identifier 0x720963ec.

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   togg
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值