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