Linux磁盘管理命令(fdisk,mount,umount,mkfs)
查看磁盘:fdisk -l
[root@wendyhost ~]# fdisk -l
Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1057 8385930 83 Linux
/dev/sda3 1058 1815 6088635 82 Linux swap / Solaris
/dev/sda4 1816 7832 48331552+ 5 Extended
/dev/sda5 1816 2859 8385898+ 83 Linux
/dev/sda6 2860 3381 4192933+ 83 Linux
/dev/sda7 3382 3903 4192933+ 83 Linux
/dev/sda8 3904 7832 31559661 83 Linux
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
以上有2块磁盘,/dev/sdb没有分区
进行分区: fdisk /dev/sdb
[root@wendyhost ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help):m 帮助
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): p查看分区
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): n加分区add a new partition
Command (m for help): n
Command action
e extended 扩展分区可以添加一个
p primary partition (1-4)个
- 主分区+扩展分区不能超过4个
- 扩展分区是不能用的,只能在扩展分区下添加逻辑分区
- 一块磁盘可以分14个分区
e
Partition number (1-4):
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130
Command (m for help): p
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 130 1044193+ 5 Extended
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130): +50M
Command (m for help): p
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 130 1044193+ 5 Extended
/dev/sdb5 1 7 56164+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@wendyhost ~]#
[root@wendyhost ~]# partprobe
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
[root@wendyhost ~]#
使用分区:mkfs.ext3 /dev/sdb5
[root@wendyhost ~]# mkfs.ext3 /dev/sdb5
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
14056 inodes, 56164 blocks
2808 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=57671680
7 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
将分区mount到目录上,这样才能使用
[root@wendyhost ~]# mount
/dev/sda2 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda8 on /u01 type ext3 (rw)
/dev/sda7 on /home type ext3 (rw)
/dev/sda6 on /var type ext3 (rw)
/dev/sda5 on /usr type ext3 (rw)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
.host:/ on /mnt/hgfs type vmhgfs (rw,ttl=1)
none on /proc/fs/vmblock/mountPoint type vmblock (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
以上是开机自动mount的
将sdb5分区mount到目录/mnt上:mount /dev/sdb5 /mnt
[root@wendyhost ~]# mount /dev/sdb5 /mnt
[root@wendyhost ~]# cd /mnt
[root@wendyhost mnt]# pwd
/mnt
[root@wendyhost mnt]# ls
lost+found
[root@wendyhost mnt]# touch test
[root@wendyhost mnt]# ls
lost+found test
创建了test文件,该文件是写在sdb5分区的磁盘上。
[root@wendyhost mnt]# mount
/dev/sda2 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda8 on /u01 type ext3 (rw)
/dev/sda7 on /home type ext3 (rw)
/dev/sda6 on /var type ext3 (rw)
/dev/sda5 on /usr type ext3 (rw)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
.host:/ on /mnt/hgfs type vmhgfs (rw,ttl=1)
none on /proc/fs/vmblock/mountPoint type vmblock (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/sdb5 on /mnt type ext3 (rw)
如果umount /dev/sdb5,则在/mnt下看不到test文件。
[root@wendyhost /]# umount /dev/sdb5
Linux磁盘管理命令(fdisk,mount,umount,mkfs)的更多相关文章
- Linux磁盘管理命令
1.磁盘分割: fdisk [root@linux ~]# fdisk [-l] 装置名称 参数: -l :输出后面接的装置所有的partition内容.若仅有fdisk -l时, 则系统将会把整个系 ...
- linux 磁盘管理命令之df-(转自 Howie的专栏)
linux中df命令的功能是用来检查linux服务器的文件系统的磁盘空间占用情况.可以利用该命令来获取硬盘被占用了多少空间,目前还剩下多少空间等信息. 1.命令格式: df [选项] [文件] 2.命 ...
- 攻城狮在路上(叁)Linux(二十二)--- linux磁盘挂载与卸载 mount umount
挂载就是将文件系统与目录结合的操作.挂载点就是目录,该目录就是进入分区或文件系统的入口. 一.挂载前的注意事项: 1.单一文件系统不应该被重复挂载在不同的挂载点中. 2.单一目录不应该重复挂载多个文件 ...
- Linux 磁盘管理命令
df NO1. 显示所有存储系统空间使用情况,同时显示存储系统的文件系统类型s[root@rehat root]# df -aT NO2. 显示指定文件系统的空间使用情况[root@rehat roo ...
- linux基本命令之磁盘管理命令(ls,cd,pwd,mkdir,rmdir,clear, touch)
linux磁盘管理命令 1.ls(list)命令:列出目录内容. 格式:ls [参数][文件或目录] ls -a或-all表示列出所有文件和目录,以点开始的是影藏文件,例如,.bash_history ...
- Linux 磁盘管理(df fu fdisk mkfs mount)
Linux 磁盘管理 Linux磁盘管理好坏直接关系到整个系统的性能问题. Linux磁盘管理常用三个命令为df.du和fdisk. df : 列出文件系统的整体磁盘使用量 du : 检查磁盘空间使用 ...
- linux常用命令之--磁盘管理命令
linux的磁盘管理命令 1.查看磁盘空间 df:用于显示磁盘空间的使用情况 其命令格式如下: df [-option] 常用参数: -i:使用inodes显示结果 -k:使用KBytes显示结果 - ...
- Linux 磁盘管理的命令
Linux 磁盘管理 磁盘分区及挂载: 先查询系统的使用情况: 使用fdisk -l语句 查询结果: 进行磁盘的新建:***添加磁盘时系统必须处于关机状态** 在进行对系统磁盘的使用情况的查询 查 ...
- df、du、fdisk:Linux磁盘管理三板斧的使用心得(转载)
From:http://os.51cto.com/art/201012/240726_all.htm 作者介绍:李洋(博客),博士毕业于中科院计算所.10多年来一直从事计算机网络信息安全研发工作,曾主 ...
随机推荐
- mysql 查询锁,解锁语句
一:锁表: 锁定数据表,避免在备份过程中,表被更新 mysql>LOCK TABLES tbl_name READ; 为表增加一个写锁定: mysql>LOCK TABLES tbl_na ...
- mysql操作索引的sql语句
创建索引 一:唯一索引alter table table_name add unique index_name(column_list); 例如:alter table users_game_task ...
- SiteWhere物联网云平台架构
SystemArchitecture系统架构 Thisdocument describes the components that make up SiteWhere and how theyrela ...
- 2.Stacks(堆栈)
一.概述 C++ Stack(堆栈) 是一个容器类的改编,为程序员提供了堆栈的全部功能,也就是说实现了一个先进后出(FILO)的数据结构. 二.常用API empty() 堆栈为空则返回真 pop() ...
- 文件上传之 commons-fileupload(二)
对commons fileupload上传组件的简单封装 在上一篇文章<利用Jakarta commons fileupload组件实现多文件上传>中,我介绍了commons fileup ...
- [Python]计算闰年时候出现的and和or优先级的问题以及短路逻辑
好吧题目非常easy.可是有些细节还是挺有意思的. 题目是:计算今年是否是闰年,推断闰年条件,满足年份模400为0,或者模4为0可是模100不为0 答案是这种: import time #计算今年是否 ...
- c# 中的UserControl是什么 用户控件和自定义控件有什么区别
用户控件是许多控件的集成 自定义控件是自己写一个控件类,或者继承已有的控件类 复合控件是封装在公共容器内的 Windows 窗体控件的集合.这种控件有时称为“用户控件”.包含的控件称为“构成控件”. ...
- 最纯粹的直播技术实战02-Camera的处理以及推流
最纯粹的直播技术实战02-Camera的处理以及推流 最新实战教程.Android自己主动化刷量.作弊与防作弊.案例:刷友盟统计.批量注冊苹果帐号 这个系列的文章将会研究最纯粹的Android直播的实 ...
- 谈谈对XML的理解?说明Web应用中Web.xml文件的作用?
谈谈对XML的理解?说明Web应用中Web.xml文件的作用? 解答:XML(Extensible Markup Language)即可扩展标记语言,它与HTML一样,都是SGML(Standard ...
- 刚新建好的动态网站项目,创建jsp页面就报错
拿到刚刚可以运行的Eclipse,就马上想敲码了,但一创建项目之后再创建jsp页面就报错= =! 报错的内容大概为缺乏对应的jar包. 我们常用Tomcat为中间体,而他本身是带有开发jsp网站的对应 ...