美文网首页
磁盘挂载

磁盘挂载

作者: 米开朗基乐 | 来源:发表于2018-04-24 17:47 被阅读0次

    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
    

    相关文章

      网友评论

          本文标题:磁盘挂载

          本文链接:https://www.haomeiwen.com/subject/rsvujxtx.html