Linux 磁盘认识
2017-11-16 17:30
274 查看
硬盘结构:
查看磁盘空间使用了多少?接近100%就是枯竭了
[root@admin ~]# df-h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 9.4G 3.5G 5.4G 40% /
tmpfs 491M 76K 491M 1% /dev/shm
/dev/sda1 190M 36M 145M 20% /boot
查看sda1 分区里block大小
[root@admin ~]#tune2fs -l /dev/sda1 | grep --color size
Filesystemfeatures: has_journal ext_attrresize_inode dir_index filetype needs_recovery extent flex_bg sparse_superhuge_file uninit_bg dir_nlink extra_isize
Block size: 1024
Fragmentsize: 1024
Flex block groupsize: 16
Inode size: 128
SAS和SATA接口对比
硬盘结构
查看sda1分区有block大小
[root@admin ~]#tune2fs -l /dev/sda1 | grep --color size
查看磁盘空间使用了多少?接近100%就是枯竭了
[root@admin ~]# df-h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 9.4G 3.5G 5.4G 40% /
tmpfs 491M 76K 491M 1% /dev/shm
/dev/sda1 190M 36M 145M 20% /boot
查看sda1 分区里block大小
[root@admin ~]#tune2fs -l /dev/sda1 | grep --color size
Filesystemfeatures: has_journal ext_attrresize_inode dir_index filetype needs_recovery extent flex_bg sparse_superhuge_file uninit_bg dir_nlink extra_isize
Block size: 1024
Fragmentsize: 1024
Flex block groupsize: 16
Inode size: 128
分区:
留了8G左右空间
fdisk
#fdisk –l #查看磁盘信息
#fdisk /dev/sdb #创建/管理分区
m 获得帮助
p 打印分区表
n 新建
p 主分区 ,e 扩展 #在MBR这样分区表中,只有一个扩展分区,最多4个主分区
q 退出
d 删除
w 保存
给磁盘分区实例:
[root@MK~]# fdisk /dev/sda
WARNING:DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') andchange display units to
sectors (command 'u').
Command(m for help): p
Disk /dev/sda:10.7 GB, 10737418240 bytes
255 heads, 63sectors/track, 1305 cylinders
Units = cylindersof 16065 * 512 = 8225280 bytes
Sector size(logical/physical): 512 bytes / 512 bytes
I/O size(minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000dadb8
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 doesnot end on cylinder boundary.
/dev/sda2 26 287 2097152 83 Linux
Partition 2 doesnot end on cylinder boundary.
/dev/sda3 287 385 786432 82 Linux swap / Solaris
Partition 3 doesnot end on cylinder boundary.
Command(m for help): n
Command action
e extended
p primary partition (1-4)
e
Selected partition4
First cylinder(385-1305, default 385):
Using defaultvalue 385
Lastcylinder, +cylinders or +size{K,M,G} (385-1305, default 1305): +6G
Command(m for help): P
Disk /dev/sda:10.7 GB, 10737418240 bytes
255 heads, 63sectors/track, 1305 cylinders
Units = cylindersof 16065 * 512 = 8225280 bytes
Sector size(logical/physical): 512 bytes / 512 bytes
I/O size(minimum/optimal): 512 bytes / 512 bytes
Disk identifier:0x000dadb8
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 doesnot end on cylinder boundary.
/dev/sda2 26 287 2097152 83 Linux
Partition 2 doesnot end on cylinder boundary.
/dev/sda3 287 385 786432 82 Linux swap / Solaris
Partition 3 doesnot end on cylinder boundary.
/dev/sda4 385 1168 6292552 5 Extended
Command(m for help): n
First cylinder(385-1168, default 385):
Using defaultvalue 385
Lastcylinder, +cylinders or +size{K,M,G} (385-1168, default 1168): +2G
Command(m for help): p
Disk /dev/sda:10.7 GB, 10737418240 bytes
255 heads, 63sectors/track, 1305 cylinders
Units = cylindersof 16065 * 512 = 8225280 bytes
Sector size(logical/physical): 512 bytes / 512 bytes
I/O size(minimum/optimal): 512 bytes / 512 bytes
Disk identifier:0x000dadb8
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 doesnot end on cylinder boundary.
/dev/sda2 26 287 2097152 83 Linux
Partition 2 doesnot end on cylinder boundary.
/dev/sda3 287 385 786432 82 Linux swap / Solaris
Partition 3 doesnot end on cylinder boundary.
/dev/sda4 385 1168 6292552 5 Extended
/dev/sda5 385 646 2099555+ 83 Linux
Command(m for help): w
The partitiontable has been altered!
Calling ioctl() tore-read partition table.
WARNING:Re-reading the partition table failed with error 16: Device or resource busy.
The kernel stilluses the old table. The new table will be used at
the next reboot orafter you run partprobe(8) or kpartx(8)
Syncing disks.
[root@MK~]# partprobe /dev/sda
Warning: WARNING:the kernel failed to re-read the partition table on /dev/sda (Device orresource busy). As a result, it may notreflect all of your changes until after reboot.
[root@MK ~]#
重启电脑生效
重启完之后创建挂在点
[root@MK~]# mkfs.ext4 /dev/sda5 (必须要格式化/dev/sda5后才能使用…这时候mount/dev/sda5 /sda5/才会生效)
[root@MK ~]# mkdir/sda5
[root@MK ~]# mount/dev/sda5 /sda5/
[root@MK ~]# ls/sda5/
lost+found
[root@MK ~]# df -h(查看有没有挂载上?出现sda5了就是挂载上了)
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 2.0G 1.4G 470M 75% /
tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 190M 36M 145M 20% /boot
/dev/sda5 2.0G 3.1M 1.9G 1% /sda5
[root@MK ~]#
查看磁盘空间使用了多少?接近100%就是枯竭了
[root@admin ~]# df-h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 9.4G 3.5G 5.4G 40% /
tmpfs 491M 76K 491M 1% /dev/shm
/dev/sda1 190M 36M 145M 20% /boot
查看sda1 分区里block大小
[root@admin ~]#tune2fs -l /dev/sda1 | grep --color size
Filesystemfeatures: has_journal ext_attrresize_inode dir_index filetype needs_recovery extent flex_bg sparse_superhuge_file uninit_bg dir_nlink extra_isize
Block size: 1024
Fragmentsize: 1024
Flex block groupsize: 16
Inode size: 128
SAS和SATA接口对比
硬盘结构
查看sda1分区有block大小
[root@admin ~]#tune2fs -l /dev/sda1 | grep --color size
查看磁盘空间使用了多少?接近100%就是枯竭了
[root@admin ~]# df-h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 9.4G 3.5G 5.4G 40% /
tmpfs 491M 76K 491M 1% /dev/shm
/dev/sda1 190M 36M 145M 20% /boot
查看sda1 分区里block大小
[root@admin ~]#tune2fs -l /dev/sda1 | grep --color size
Filesystemfeatures: has_journal ext_attrresize_inode dir_index filetype needs_recovery extent flex_bg sparse_superhuge_file uninit_bg dir_nlink extra_isize
Block size: 1024
Fragmentsize: 1024
Flex block groupsize: 16
Inode size: 128
分区:
留了8G左右空间
fdisk
#fdisk –l #查看磁盘信息
#fdisk /dev/sdb #创建/管理分区
m 获得帮助
p 打印分区表
n 新建
p 主分区 ,e 扩展 #在MBR这样分区表中,只有一个扩展分区,最多4个主分区
q 退出
d 删除
w 保存
给磁盘分区实例:
[root@MK~]# fdisk /dev/sda
WARNING:DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') andchange display units to
sectors (command 'u').
Command(m for help): p
Disk /dev/sda:10.7 GB, 10737418240 bytes
255 heads, 63sectors/track, 1305 cylinders
Units = cylindersof 16065 * 512 = 8225280 bytes
Sector size(logical/physical): 512 bytes / 512 bytes
I/O size(minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000dadb8
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 doesnot end on cylinder boundary.
/dev/sda2 26 287 2097152 83 Linux
Partition 2 doesnot end on cylinder boundary.
/dev/sda3 287 385 786432 82 Linux swap / Solaris
Partition 3 doesnot end on cylinder boundary.
Command(m for help): n
Command action
e extended
p primary partition (1-4)
e
Selected partition4
First cylinder(385-1305, default 385):
Using defaultvalue 385
Lastcylinder, +cylinders or +size{K,M,G} (385-1305, default 1305): +6G
Command(m for help): P
Disk /dev/sda:10.7 GB, 10737418240 bytes
255 heads, 63sectors/track, 1305 cylinders
Units = cylindersof 16065 * 512 = 8225280 bytes
Sector size(logical/physical): 512 bytes / 512 bytes
I/O size(minimum/optimal): 512 bytes / 512 bytes
Disk identifier:0x000dadb8
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 doesnot end on cylinder boundary.
/dev/sda2 26 287 2097152 83 Linux
Partition 2 doesnot end on cylinder boundary.
/dev/sda3 287 385 786432 82 Linux swap / Solaris
Partition 3 doesnot end on cylinder boundary.
/dev/sda4 385 1168 6292552 5 Extended
Command(m for help): n
First cylinder(385-1168, default 385):
Using defaultvalue 385
Lastcylinder, +cylinders or +size{K,M,G} (385-1168, default 1168): +2G
Command(m for help): p
Disk /dev/sda:10.7 GB, 10737418240 bytes
255 heads, 63sectors/track, 1305 cylinders
Units = cylindersof 16065 * 512 = 8225280 bytes
Sector size(logical/physical): 512 bytes / 512 bytes
I/O size(minimum/optimal): 512 bytes / 512 bytes
Disk identifier:0x000dadb8
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 doesnot end on cylinder boundary.
/dev/sda2 26 287 2097152 83 Linux
Partition 2 doesnot end on cylinder boundary.
/dev/sda3 287 385 786432 82 Linux swap / Solaris
Partition 3 doesnot end on cylinder boundary.
/dev/sda4 385 1168 6292552 5 Extended
/dev/sda5 385 646 2099555+ 83 Linux
Command(m for help): w
The partitiontable has been altered!
Calling ioctl() tore-read partition table.
WARNING:Re-reading the partition table failed with error 16: Device or resource busy.
The kernel stilluses the old table. The new table will be used at
the next reboot orafter you run partprobe(8) or kpartx(8)
Syncing disks.
[root@MK~]# partprobe /dev/sda
Warning: WARNING:the kernel failed to re-read the partition table on /dev/sda (Device orresource busy). As a result, it may notreflect all of your changes until after reboot.
[root@MK ~]#
重启电脑生效
重启完之后创建挂在点
[root@MK~]# mkfs.ext4 /dev/sda5 (必须要格式化/dev/sda5后才能使用…这时候mount/dev/sda5 /sda5/才会生效)
[root@MK ~]# mkdir/sda5
[root@MK ~]# mount/dev/sda5 /sda5/
[root@MK ~]# ls/sda5/
lost+found
[root@MK ~]# df -h(查看有没有挂载上?出现sda5了就是挂载上了)
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 2.0G 1.4G 470M 75% /
tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 190M 36M 145M 20% /boot
/dev/sda5 2.0G 3.1M 1.9G 1% /sda5
[root@MK ~]#
相关文章推荐
- 关于对linux磁盘 分区 挂载的最新认识
- Linux 磁盘与文件系统管理:认识 EXT2 文件系统
- Linux磁盘与文件系统管理 之 认识EXT2系统
- Linux磁盘与文件系统管理 之 认识EXT2系统
- chapter8:Linux磁盘与文件系统管理之(1)认识Ext2文件系统
- linux 磁盘管理三部曲——(1)磁盘结构,认识分区
- 如何在 Linux 中整理磁盘碎片
- Linux查看与挂载新磁盘
- linux下磁盘性能分析
- Linux 磁盘命令
- Linux的shell认识和其本应用
- linux磁盘阵列实战
- Linux入门之磁盘管理(3)文件系统挂载
- Linux磁盘空间
- Linux系统 获取磁盘信息/proc/mtab
- linux下使用 du查看某个文件或目录占用磁盘空间的大小
- Linux命令之磁盘管理
- 认识linux input子系统(一)
- Linux时间子系统之一:认识timer_list和timer_stats和使用
- linux如何查看磁盘剩余空间