磁盘挂载

Linux新添加的硬盘,需要挂载。方法如下

[root@oracledb /]# fdisk /dev/vdb#进入磁盘初始化
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xc0fe6104.
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): n#第一步
Command action
   e   extended
   p   primary partition (1-4)
p#第二步
Partition number (1-4): 1#默认1
First cylinder (1-1040253, default 1): #回车
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1040253, default 1040253): #回车,默认最大值
Using default value 1040253

Command (m for help): p#第三步,再次查看,下面是刚刚分出来的

Disk /dev/vdb: 536.9 GB, 536870912000 bytes
16 heads, 63 sectors/track, 1040253 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc0fe6104

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1               1     1040253   524287480+  83  Linux

Command (m for help): w#保存退出
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@oracledb /]# fdisk -l#查看一下,哎~有了

Disk /dev/vda: 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: 0x00071419

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *           1        5222    41940992   83  Linux

Disk /dev/vdb: 536.9 GB, 536870912000 bytes
16 heads, 63 sectors/track, 1040253 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc0fe6104

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1               1     1040253   524287480+  83  Linux
[root@oracledb /]# mkfs.ext3 /dev/vdb1#格式化刚刚的那个分区,格式为ext3,注意名字已经变为vdb1了,不要打错了
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
32768000 inodes, 131071870 blocks
6553593 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
4000 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
    4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
    102400000

Writing inode tables: done                            
Creating journal (32768 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@oracledb /]# mount /dev/vdb1 /u01#挂载
[root@oracledb ~]# df -h#查看一下,哎~又有了
Filesystem            Size  Used Avail Use% Mounted on
/dev/vda1              40G  2.9G   36G   8% /
tmpfs                 7.8G     0  7.8G   0% /dev/shm
/dev/vdb1             493G  4.5G  463G   1% /u01#就是我
[root@oracledb /]# mount
/dev/vda1 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/vdb1 on /u01 type ext3 (rw)#能看到这个分区,格式为ext3
设置开机启动自动挂载vi /etc/fstab
/dev/vdb1                               /home                   ext4    defaults        0  0
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Linux发行版本分区管理操作 1.1 创建分区INUXVPS下的硬盘是什么样子的?我们首先要了解Linux系统下...
    ZYK的轮子阅读 545评论 0 0
  • 磁盘格式化 演示之前我们先给sdb磁盘(如果没有,自己手动增加)分区先; 接下来我们正式的开始格式化,这里我们先认...
    hch004阅读 887评论 1 0
  • 查看硬盘个数及分区 对/dev/vdb进行分区空白处敲一记回车 再次查看磁盘个数及分区 格式化新分区(使用ext3...
    __Bw__阅读 983评论 0 1
  • 通常在完成了磁盘的分区,格式化后,管理员都会将对应的磁盘分区挂载到系统的某一路径之下。这里的挂载指的就是将磁盘分区...
    小尛酒窝阅读 10,080评论 0 1
  • 快结束时感到能量到丹田部位了,一会转化成左边一个约鸡蛋大小的紧、胀、堵。后面渐渐没有那么明显了。结束时脚后跟几乎麻...
    张德芬幸福驿站咸阳阅读 305评论 0 0