美文网首页
Linux mount 硬盘挂载

Linux mount 硬盘挂载

作者: IT教程 | 来源:发表于2017-08-03 23:38 被阅读28次

    欢迎访问我的个人博客网站:http://www.yanmin99.com/

    1、查看硬盘信息

    • fdisk -l
     Disk /dev/xvda: 21.5 GB, 21474836480 bytes
     255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
     Units = sectors of 1 * 512 = 512 bytes
     Sector size (logical/physical): 512 bytes / 512 bytes
     I/O size (minimum/optimal): 512 bytes / 512 bytes
     Disk identifier: 0x000da36d
     Device Boot Start End Blocks Id System
     /dev/xvda1 * 2048 41940991 20969472 83 Linux
     Disk /dev/xvdb: 107.4 GB, 107374182400 bytes
     255 heads, 63 sectors/track, 13054 cylinders, total 209715200 sectors
     Units = sectors of 1 * 512 = 512 bytes
     Sector size (logical/physical): 512 bytes / 512 bytes
     I/O size (minimum/optimal): 512 bytes / 512 bytes
     Disk identifier: 0x00000000
     Disk /dev/xvdb doesn't contain a valid partition table
    
    

    2、进入磁盘,对磁盘进行分区

    • fdisk /dev/xvdb
    Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
    Building a new DOS disklabel with disk identifier 0xabf49954.
    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)
    Command (m for help): n
    Partition type:
    p primary (0 primary, 0 extended, 4 free)
    e extended
    Select (default p): p
    Partition number (1-4, default 1): 1
    First sector (2048-209715199, default 2048):
    Using default value 2048
    Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199):
    Using default value 209715199
    Command (m for help): w
    The partition table has been altered!
    Calling ioctl() to re-read partition table.
    Syncing disks.
    
    

    ``

    • fdisk -l
    Disk /dev/xvda: 21.5 GB, 21474836480 bytes
    255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x000da36d
    Device Boot Start End Blocks Id System
    /dev/xvda1 * 2048 41940991 20969472 83 Linux
    Disk /dev/xvdb: 107.4 GB, 107374182400 bytes
    43 heads, 44 sectors/track, 110843 cylinders, total 209715200 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0xabf49954
    Device Boot Start End Blocks Id System
    /dev/xvdb1 2048 209715199 104856576 83 Linux
    
    

    3、格式化分区

    • mkfs.ext3 /dev/xvdb1 (将/dev/xvdb1格式化为ext3类型)
    mke2fs 1.42.9 (4-Feb-2014)
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=0 blocks, Stripe width=0 blocks
    6553600 inodes, 26214144 blocks
    1310707 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=4294967296
    800 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
    Allocating group tables: done
    Writing inode tables: done
    Creating journal (32768 blocks): done
    Writing superblocks and filesystem accounting information: done
    

    4、创建/disk2目录

    • mkdir /disk2

    5、挂载

    • mount /dev/xvdb1 /disk2/

    6、查看硬盘大小以及挂载分区

    • df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/xvda1 20G 16G 3.4G 82% /
    none 4.0K 0 4.0K 0% /sys/fs/cgroup
    udev 3.9G 4.0K 3.9G 1% /dev
    tmpfs 799M 392K 799M 1% /run
    none 5.0M 0 5.0M 0% /run/lock
    none 3.9G 0 3.9G 0% /run/shm
    none 100M 0 100M 0% /run/user
    /dev/xvdb1 99G 60M 94G 1% /disk2
    

    7、配置开机自动挂载

    • vim /etc/fstab
    /dev/xvdb1 /disk2 ext3 defaults 0 0
    

    相关文章

      网友评论

          本文标题:Linux mount 硬盘挂载

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