linux如何添加硬盘分区挂载
发表于:2024-10-18 作者:千家信息网编辑
千家信息网最后更新 2024年10月18日,这篇文章主要介绍了linux如何添加硬盘分区挂载,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。基本步骤:分区--格式化--挂载--写入
千家信息网最后更新 2024年10月18日linux如何添加硬盘分区挂载
这篇文章主要介绍了linux如何添加硬盘分区挂载,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
基本步骤:分区--格式化--挂载--写入文件
1、首先用fdisk -l命令查看添加的硬盘名称,可以看到sdb为新增的硬盘
[root@oracle ~]# fdisk -lDisk /dev/sdb: 21.5 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000Disk /dev/sda: 21.5 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x0006b59cDevice Boot Start End Blocks Id System/dev/sda1 * 1 39 307200 83 LinuxPartition 1 does not end on cylinder boundary./dev/sda2 39 2358 18631680 83 Linux/dev/sda3 2358 2611 2031616 82 Linux swap / Solaris
2、进行分区,输入m查看提示
[root@oracle ~]# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel with disk identifier 0x09f38795.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) WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): mCommand 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)
分析:主要参数的解析
1. 输入 m 显示所有命令列示。
2. 输入 p 显示硬盘分割情形,打印分区表。
3. 输入 a 设定硬盘启动区。
4. 输入 n 创建新的硬盘分割区。
4.1. 输入 e 硬盘为[延伸]分割区(extend)。
4.2. 输入 p 硬盘为[主要]分割区(primary)。
5. 输入 t 改变硬盘分割区属性。
t:分区系统id号
L:82:linux swap
83:linux
86:NTFS window分区
6. 输入 d 删除硬盘分割区属性。
7. 输入 q 结束不存入硬盘分割区属性。
8. 输入 w 结束并写入硬盘分割区属性
3、输入n创建新的硬盘分区--输入p创建主分区--输入1设置一个分区--回车--回车(默认全部空间)
Command (m for help): nCommand action e extended ···扩展分区 p primary partition (1-4) ···主分区pPartition number (1-4): 1First cylinder (1-2610, default 1): Using default value 1Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): Using default value 2610
4、输入p查看分区情况--输入w保存退出(一定要w保存不然无效)
Command (m for help): p Disk /dev/sdb: 21.5 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x09f38795 Device Boot Start End Blocks Id System/dev/sdb1 1 2610 20964793+ 83 Linux Command (m for help): wThe partition table has been altered! Calling ioctl() to re-read partition table.Syncing disks.
5、mkfs命令格式化磁盘
[root@oracle ~]# mkfs.ext4 /dev/sdbmkfs.ext4: invalid fragment size - /dev/sdb
6、mount命令挂载分区
[root@oracle ~]# mount /dev/sdb /oracle/You have new mail in /var/spool/mail/root[root@oracle ~]# df -THFilesystem Type Size Used Avail Use% Mounted on/dev/sda2 ext4 19G 11G 7.3G 60% /tmpfs tmpfs 2.1G 74k 2.1G 1% /dev/shm/dev/sda1 ext4 297M 29M 253M 11% /boot/dev/sdb ext4 22G 47M 20G 1% /oracle
7、添加到/etc/fstab文件下保存退出否则重启后硬盘消失
/dev/sdb /oracle ext4 defaults,noatime 0 0
感谢你能够认真阅读完这篇文章,希望小编分享的"linux如何添加硬盘分区挂载"这篇文章对大家有帮助,同时也希望大家多多支持,关注行业资讯频道,更多相关知识等着你来学习!
输入
硬盘
命令
属性
篇文章
文件
格式
价值
兴趣
参数
同时
名称
情况
情形
更多
朋友
步骤
知识
磁盘
空间
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
招联金融软件开发薪资
上海网络安全准入控制系统报价
分布式中间件和数据库
.db文件怎么连接数据库
服务器内轨拆卸
数据库系统安全控制器
软件开发 广告语
多能服务器
怎么画网络安全的漫画
山西晋享团购互联网科技有限公司
windows多服务器管理
mysql数据库能联网吗
是前端好还是数据库好
网络安全在我身边从我做起
丰台区智能网络技术诚信经营
网络技术及应用心得体会
上海免费项目管控软件开发平台
服务器ip和端口总变
芯片设计公司软件开发
数据库管理员表谁是子表
cf本地服务器代码错误
中全通网络技术有限公司工资
虚拟服务器打完补丁启动不了
osek软件开发流程
数据库技术的日常应用
深圳管理软件开发价格
猿宝互联网科技公司怎么样
关于网络安全的小故事
闲鱼服务器48g价格
现在网络安全是指什么