系统分区管理
/sda 系统第一块串口硬盘,a代表第一块
/cdrom,/dev/sr0 代表光驱
/hd0 系统闭口硬盘
/mapper/ 软件虚拟的设备
硬盘的分区:MBR、扩展分区、逻辑分区
设备的管理
查询设备的几种方式:
fdisk -l # 发现磁盘,查看系统当中真实存在的设备,检测硬件信息,不一定被系统识别
df #默认显示大小k,查看系统中正在使用的
cat /proc/partitions #查看系统识别的设备,不一定可以用
blkid #系统中正在用或可以用的设备
下面是用上述方法查看设备的测试:
1、fdisk -l #发现磁盘,查看系统当中真实存在的设备,检测硬件信息,不一定被系统识别
[root@foundation69 Desktop]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: gpt
# Start End Size Type Name
1 2048 534527 260M EFI System EFI System Partition
2 534528 567295 16M Microsoft reser Microsoft reserved partition
3 567296 210282495 100G Microsoft basic Basic data partition
4 210282496 783722495 273.4G Microsoft basic Basic data partition
5 783722496 1357162495 273.4G Microsoft basic Basic data partition
6 1566877696 1923518463 170.1G Microsoft basic Basic data partition
7 1923520512 1925568511 1000M Windows recover Basic data partition
8 1925568512 1951475711 12.4G Windows recover Basic data partition
9 1951475712 1953523711 1000M unknown Basic data partition
10 1357162496 1358186495 500M Microsoft basic
11 1358186496 1374441471 7.8G Linux swap
12 1374441472 1566877695 91.8G Microsoft basic
Disk /dev/sdb: 15.5 GB, 15500574720 bytes, 30274560 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 label type: dos
Disk identifier: 0x491e3623
Device Boot Start End Blocks Id System
/dev/sdb1 63 30274271 15137104+ b W95 FAT32
2、cat /proc/partitions #查看系统识别的设备,不一定可以用
[root@foundation69 Desktop]# cat /proc/partitions
major minor #blocks name
8 0 976762584 sda
8 1 266240 sda1
8 2 16384 sda2
8 3 104857600 sda3
8 4 286720000 sda4
8 5 286720000 sda5
8 6 178320384 sda6
8 7 1024000 sda7
8 8 12953600 sda8
8 9 1024000 sda9
8 10 512000 sda10
8 11 8127488 sda11
8 12 96218112 sda12
7 0 3655680 loop0
7 1 3948544 loop1
8 16 15137280 sdb
8 17 15137104 sdb1
3、blkid #系统中正在用或可以用的设备
[root@foundation69 Desktop]# blkid
/dev/sda1: LABEL="SYSTEM_DRV" UUID="2C9D-3FF5" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="42ff9e47-dded-464d-821a-f5a0c208241e"
/dev/sda2: PARTLABEL="Microsoft reserved partition" PARTUUID="39b1cdff-4bcd-4698-8692-0b869eadf047"
/dev/sda3: LABEL="Windows" UUID="D69CA0BA9CA09691" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="11d14992-fa38-4605-bbab-7e4fb1ad591a"
/dev/sda4: UUID="C2762FEE762FE241" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="c4432fec-f9d7-4bd6-ac98-2a5bfc44fd7f"
/dev/sda5: UUID="A8FE5AD7FE5A9CFE" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="da859020-9702-4ab6-8c89-ab9d0d30bb9a"
/dev/sda6: LABEL="M-fM-^\M-,M-eM-^\M-0M-gM-#M-^AM-gM-^[M-^X" UUID="FCCC321DCC31D31E" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="adf65f15-1033-4d6d-8433-7bb2dbc0f313"
/dev/sda7: LABEL="WINRE_DRV" UUID="4A389058389044BB" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="bf76e1f5-4e25-4e4d-abe8-e7b69b5281ac"
/dev/sda8: LABEL="LENOVO_PART" UUID="9EF894D0F894A7D3" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="a907a59f-84aa-4e45-bf6d-00f711474db0"
/dev/sda9: LABEL="LRS_ESP" UUID="76AA-2F71" TYPE="vfat" PARTLABEL="Basic data partition" PARTUUID="32751b55-dc09-4c92-9991-c96c0fb4577c"
/dev/sda10: UUID="e2951939-b44d-461c-aa97-61451d314755" TYPE="xfs" PARTUUID="24e182f5-e5c0-4677-ba99-3cc5bfed71b0"
/dev/sda11: UUID="78167bd6-fb99-4b6b-93b4-34e8dca06c82" TYPE="swap" PARTUUID="93964b3e-a068-4a32-8c69-5a82b5c0fe63"
/dev/sda12: UUID="ae1be246-09c6-4293-b590-89f8356a422f" TYPE="xfs" PARTUUID="e0144b46-05cc-417e-912d-11240366c076"
/dev/loop0: UUID="2014-05-07-03-58-46-00" LABEL="RHEL-7.0 Server.x86_64" TYPE="iso9660" PTTYPE="dos"
/dev/loop1: UUID="2015-10-30-11-11-49-00" LABEL="RHEL-7.2 Server.x86_64" TYPE="iso9660" PTTYPE="dos"
/dev/sdb1: LABEL="KINGSTON" UUID="08E4-2A63" TYPE="vfat"
4、
df #默认显示大小k,查看系统中正在使用的
df -H #10的n次方,1兆为1000k
df -h #2的n次方,1兆为1024k,更精确
[root@foundation69 Desktop]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda12 96171132 19536600 76634532 21% /
devtmpfs 3910380 0 3910380 0% /dev
tmpfs 3925144 552 3924592 1% /dev/shm
tmpfs 3925144 9308 3915836 1% /run
tmpfs 3925144 0 3925144 0% /sys/fs/cgroup
/dev/sda10 505580 150328 355252 30% /boot
/dev/sda1 262144 37276 224868 15% /boot/efi
/dev/loop0 3654720 3654720 0 100% /var/www/html/source7.0
/dev/loop1 3947824 3947824 0 100% /var/www/html/source7.2
tmpfs 785032 24 785008 1% /run/user/1000
/dev/sdb1 15122312 7738320 7383992 52% /run/media/kiosk/KINGSTON
[root@foundation69 Desktop]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda12 92G 19G 74G 21% /
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.8G 552K 3.8G 1% /dev/shm
tmpfs 3.8G 9.1M 3.8G 1% /run
tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup
/dev/sda10 494M 147M 347M 30% /boot
/dev/sda1 256M 37M 220M 15% /boot/efi
/dev/loop0 3.5G 3.5G 0 100% /var/www/html/source7.0
/dev/loop1 3.8G 3.8G 0 100% /var/www/html/source7.2
tmpfs 767M 24K 767M 1% /run/user/1000
/dev/sdb1 15G 7.4G 7.1G 52% /run/media/kiosk/KINGSTON
[root@foundation69 Desktop]# df -H
Filesystem Size Used Avail Use% Mounted on
/dev/sda12 99G 21G 79G 21% /
devtmpfs 4.1G 0 4.1G 0% /dev
tmpfs 4.1G 566k 4.1G 1% /dev/shm
tmpfs 4.1G 9.6M 4.1G 1% /run
tmpfs 4.1G 0 4.1G 0% /sys/fs/cgroup
/dev/sda10 518M 154M 364M 30% /boot
/dev/sda1 269M 39M 231M 15% /boot/efi
/dev/loop0 3.8G 3.8G 0 100% /var/www/html/source7.0
/dev/loop1 4.1G 4.1G 0 100% /var/www/html/source7.2
tmpfs 804M 25k 804M 1% /run/user/1000
/dev/sdb1 16G 8.0G 7.6G 52% /run/media/kiosk/KINGSTON
sdb1代表系统上的第一个分区
mount /dev/sdb1 /mnt #将设备挂载在mnt上,读写挂载
[root@foundation69 Desktop]# mount /dev/sdb1 /mnt #将设备vdb1挂载在mnt上
[root@foundation69 Desktop]# df #查看挂载情况
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda12 96171132 19536604 76634528 21% /
devtmpfs 3910380 0 3910380 0% /dev
tmpfs 3925144 552 3924592 1% /dev/shm
tmpfs 3925144 9308 3915836 1% /run
tmpfs 3925144 0 3925144 0% /sys/fs/cgroup
/dev/sda10 505580 150328 355252 30% /boot
/dev/sda1 262144 37276 224868 15% /boot/efi
/dev/loop0 3654720 3654720 0 100% /var/www/html/source7.0
/dev/loop1 3947824 3947824 0 100% /var/www/html/source7.2
tmpfs 785032 24 785008 1% /run/user/1000
/dev/sdb1 15122312 7738320 7383992 52% /mnt
umount /mnt|/dev/sdb1 #卸载设备,当设备有任务执行时不能卸载设备
[root@foundation69 Desktop]# umount /mnt
[root@foundation69 Desktop]# df
Filesystem 1K-blocks Used Available Use% M