专栏首页杨建荣的学习笔记linux下挂载新硬盘和分区的步骤 (50天)

linux下挂载新硬盘和分区的步骤 (50天)

今天和大家分享一下在linux下挂载新硬盘的步骤。 演示的环境基于centos [root@localhost etc]# uname -a Linux localhost.localdomain 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86_64 x86_64 x86_64 GNU/Linux [root@localhost etc]# cat system-release CentOS release 6.2 (Final) [root@localhost etc]# 先挂载了一个3G的硬盘查看磁盘空间的情况 [root@localhost etc]# fdisk -l Disk /dev/sda: 42.9 GB, 42949672960 bytes 255 heads, 63 sectors/track, 5221 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: 0x0004daae Device Boot Start End Blocks Id System /dev/sda1 * 1 39 307200 83 Linux Partition 1 does not end on cylinder boundary. /dev/sda2 39 4998 39832576 83 Linux /dev/sda3 4998 5222 1802240 82 Linux swap / Solaris Disk /dev/sdb: 3221 MB, 3221225472 bytes 255 heads, 63 sectors/track, 391 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: 0x00000000 Disk /dev/sdb doesn't contain a valid partition table 划分磁盘分区,分为4个主分区,最后写入磁盘。 [root@localhost etc]# fdisk /dev/sdb 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 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): n Command action e extended p primary partition (1-4) p Partition number (1-4): 4 First cylinder (1-391, default 1): 1 Last cylinder, +cylinders or +size{K,M,G} (1-391, default 391): 100 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (101-391, default 101): 101 Last cylinder, +cylinders or +size{K,M,G} (101-391, default 391): 200 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 3 First cylinder (201-391, default 201): 201 Last cylinder, +cylinders or +size{K,M,G} (201-391, default 391): 300 Command (m for help): n Command action e extended p primary partition (1-4) p Selected partition 1 First cylinder (301-391, default 301): 301 Last cylinder, +cylinders or +size{K,M,G} (301-391, default 391): 391 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@localhost etc]# fdisk -l 再次查看分区情况, Disk /dev/sdb: 3221 MB, 3221225472 bytes 255 heads, 63 sectors/track, 391 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: 0xe5f51a7b Device Boot Start End Blocks Id System /dev/sdb1 301 391 730957+ 83 Linux /dev/sdb2 101 200 803250 83 Linux /dev/sdb3 201 300 803250 83 Linux /dev/sdb4 1 100 803218+ 83 Linux Partition table entries are not in disk order 我就格式化第一个分区,采用文件系统ext3. [root@localhost etc]# mkfs -t ext3 /dev/sdb1 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 45696 inodes, 182739 blocks 9136 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=188743680 6 block groups 32768 blocks per group, 32768 fragments per group 7616 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840 Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 27 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. 创建一个临时目录,然后把分区挂载到这个目录下。 [root@localhost /]# mkdir test [root@localhost /]# mount /dev/sdb1 /test 挂载后查看磁盘情况,就可以看到分区就在那了。 [root@localhost /]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 38G 32G 4.3G 89% / tmpfs 980M 288K 980M 1% /dev/shm /dev/sda1 291M 32M 244M 12% /boot /dev/sdb1 703M 17M 651M 3% /test 配置开机启动项 vi /etc/fstab LABEL=SWAP-sda2 swap swap defaults 0 0 加入如下 /dev/sdb1 /test ext3 defaults 1 1 ~ 5. 第5列为dump选项,设置是否让备份程序dump备份文件系统,0为忽略,1为备份。 6. 第6列为fsck选项,告诉fsck程序以什么顺序检查文件系统,0为忽略。

本文分享自微信公众号 - 杨建荣的学习笔记(jianrong-notes),作者:笔记50天

原文出处及转载信息见文内详细说明,如有侵权,请联系 yunjia_community@tencent.com 删除。

原始发表时间:2014-04-22

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 一个细小的空间问题触发的报警(r11笔记第68天)

    今天有一个数据库服务器报警,报警信息是来自于一个异机备库。可以看到这台服务器空间只有300多G,而剩余空间只剩下了不到30G.所以这样一个问题就很奇怪了...

    jeanron100
  • redo日志文件学习(22天)

    关于redo日志文件,今天因为要做redo日志的在线迁移,所以特意做了个简单的总结。 1. 如果要把redo的切换信息显示到alert日志中,需要设置个参数。...

    jeanron100
  • MySQL RR隔离级别的更新冲突策略

    对于事务的隔离级别,MySQL中默认是RR, Oracle中默认是RC,两个事务隔离级别存在着很大的差别,而换句话说,就算是RR的事务隔离级别级别,同是关系...

    jeanron100
  • vmware 扩展分区大小

    tanmx
  • CentOS7.x系统根目录分区扩容

    说明:系统版本为 Linux version 3.10.0-327.el7.x86_64

    拓荒者
  • 怎么创建一个伸缩磁盘呢?

    还是那个话要准...

    DataScience
  • swap

    Swap分区,即交换分区,系统在物理内存不够时,与Swap进行交换。 # free -m total used ...

    零月
  • golang日志组件使用runtime.Caller性能问题分析

    runtime.Caller能够拿到当前执行的文件名和行号,这个方法几乎所有的日志组件里都有使用。

    霸王猪
  • 融合ICT数据中心云等保2.0解决方案

    前段时间研读了公安部发布的等保2.0安全标准,有了一些自己的理解来今天来和大家分享一下,等保2.0的中心思想是“一个中心,三重防护”,一个中心指的...

    ICT售前新说
  • Angular学习笔记(一)

    Angular 应用是模块化的,并且 Angular 有自己的模块系统,它被称为 Angular 模块 或 NgModules。 Angular 模块都是一个带...

    Theo Tsao

扫码关注云+社区

领取腾讯云代金券