linux 挂载磁盘命令

linux 挂载磁盘命令把一个磁盘/dev/sda挂载到某个目录下makdir /mnt/long //创建一个空的挂载节点mount -text4 /dev/sda /mnt/long

大家好,又见面了,我是你们的朋友全栈君。

把一个磁盘/dev/sda挂载到某个目录下

makdir /mnt/long //创建一个空的挂载节点
mount -t ext4 /dev/sda /mnt/long

查看磁盘分区情况 fdisk -l

在这里插入图片描述

查看磁盘挂载情况df

在这里插入图片描述

对磁盘/dev/sdb分区

[root@localhost ~]# fdisk /dev/sdc #进入磁盘
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x45a3cadb.
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): 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  #各分区类型所对应的ID
   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/sdc: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x45a3cadb

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n **//创建一个新的分区**
Command action
   e   extended//输入e为创建扩展分区  
   p   primary partition (1-4) //输入p为创建逻辑分区  
p
Partition number (1-4): 1**//划分逻辑分区**
First cylinder (1-2610, default 1): **//我这里直接回车,是不想把该磁盘分成多个分**区,把整个磁盘作为1个分区
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): 
Using default value 2610

Command (m for help): p //再次查看可以看到该磁盘已经有1个分区了

Disk /dev/sdc: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x45a3cadb

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        2610    20964793+  83  Linux
Command (m for help): w //保存分区
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

格式化磁盘

mkfs.ext3 /dev/sdc1

修个配置文件开机自动挂载 vim /etc/fstab

vim /etc/fstab
/dev/sdc1(磁盘分区) /disk/disktwo(挂载目录) ext3(文件格式)defaults 0 0

参考:https://blog.csdn.net/weishujie000/article/details/76531924

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/150862.html原文链接:https://javaforall.net

赞 (0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Integer包装类_entityframework面试题

    Integer包装类_entityframework面试题Integer 包装类面试

    2022年4月20日
  • 黑苹果安装详细过程

    黑苹果安装详细过程前言:此教程谨献给出入黑苹果的小白们学习经验,如安装过程出现任何意外将于本人无关。鉴于网上有很多大佬写的教程,但以我的角度来看(才识浅薄),有些细节并没有提到,会让小白比较懵,所以才有了写这篇教程的想法。第一次写教程,请多指教,有写错的地方还请各路大神指正,老鸟看看就好,勿喷(感谢)(未经允许,禁止转载,请尊重)废话就不说了,直接进入正题。UEFI+GPT是前提,如果是传统引导方式的,请自行…

    2022年6月11日
  • 【java系列】unix时间戳转Date[通俗易懂]

    【java系列】unix时间戳转Date[通俗易懂]unix时间戳转Date注意,不能直接使用Integer进行乘除和转换,需要转成bigDecimal去处理,否则转换出来的时间只会是1970-xxxxpackagehutoolTest;importcn.hutool.core.date.DateTime;importjava.math.BigDecimal;importjava.text.SimpleDateFormat;importjava.util.Date;publicclassDateTest{pub

    2022年6月25日
  • 虚拟机vmware workstation安装_linux安装出现dracut

    虚拟机vmware workstation安装_linux安装出现dracut在VMwareWorkstation中安装了RedFlagLinuxDesktop觉得界面以及操作与Windows没什么两样。那末他的优点在哪里呢?我为什么要放弃用了几年的MSWindows来使用这个系统呢? 转载于:https://blog.51cto.com/89000/11249…

    2022年8月20日
  • HTML5_ScrollInToView方法「建议收藏」

    HTML5_ScrollInToView方法「建议收藏」HTML5_ScrollInToView方法 window.onload=function(){ /* 如果滚动页面也是DOM没有解决的一个问题。为了解决这个问题,浏览器实现了一下方法, 以方便开发人员如何更好的控制页面的滚动。在各种专有方法中,HTML5选择了scrollIntoView() 作为标准方法。 scrollIntoV

    2022年6月24日
  • Arping命令手册

    Arping命令手册Arping命令手册  arping-sendARPREQUESTtoaneighbourhost注释:arping是用于发送ARP请求到一个相邻主机的工具SYNOPSIS  arping  [  -AbDfhqUV][  -ccount]

    2022年6月3日

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号