zoukankan      html  css  js  c++  java
  • fdisk 磁盘分区

    1、[root@test4 ~]# fdisk /dev/sda  //对sda磁盘进行分区
    
    Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
    Building a new DOS disklabel. Changes will remain in memory only,
    until you decide to write them. After that, of course, the previous
    content won't be recoverable.
    
    
    The number of cylinders for this disk is set to 2597.
    There is nothing wrong with that, but this is larger than 1024,
    and could in certain setups cause problems with:
    1) software that runs at boot time (e.g., old versions of LILO)
    2) booting and partitioning software from other OSs
        (e.g., DOS FDISK, OS/2 FDISK)
    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
    
    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 //创建一个新的空白DOS分区表
        p   print the partition table    //打印分区表
        q   quit without saving changes  //退出不保存设置
        s   create a new empty Sun disklabel
        t   change a partition's system id  //改变分区的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                 //e是扩展分区
       p   primary partition (1-4)  //p是主分区
    p
    Partition number (1-4): 1       //定义分区数量   --主分区最多只能有四个
    First cylinder (1-2597, default 1): 1
    Last cylinder or +size or +sizeM or +sizeK (1-2597, default 2597): +100M
    
    Command (m for help): w          //保存刚才的配置信息。
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    
    WARNING: Re-reading the partition table failed with error 22: 无效的参数.
    The kernel still uses the old table.
    The new table will be used at the next reboot.
    Syncing disks.
    
    2、[root@test6 ~]# fdisk /dev/sda
    
    The number of cylinders for this disk is set to 2610.
    There is nothing wrong with that, but this is larger than 1024,
    and could in certain setups cause problems with:
    1) software that runs at boot time (e.g., old versions of LILO)
    2) booting and partitioning software from other OSs
       (e.g., DOS FDISK, OS/2 FDISK)
    
    Command (m for help): n
    First cylinder (1710-2610, default 1710): 
    Using default value 1710
    Last cylinder or +size or +sizeM or +sizeK (1710-2610, default 2610): +100M     
    
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    
    WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
    The kernel still uses the old table.
    The new table will be used at the next reboot.
    Syncing disks.
    3、[root@test6 ~]# partprobe /dev/sda //对硬盘进行更新
       [root@test6 ~]# fdisk -l
    
    Disk /dev/sda: 21.4 GB, 21474836480 bytes
    heads, 63 sectors/track, 2610 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *           1          13      104391   83  Linux
    /dev/sda2              14         274     2096482+  82  Linux swap / Solaris
    /dev/sda3             275         404     1044225   8e  Linux LVM
    /dev/sda4             405        2610    17719695    5  Extended
    /dev/sda5             405        1709    10482381   83  Linux
    /dev/sda6            1710        1722      104391   83  Linux
    4、[root@test6 ~]# mkfs.ext3 /dev/sda6  //需要先进行格式化,才能使用 。mkfs -t ext3 /dev/sda5 (mkfs.ext3 一样效果 -t 指定类型 -b 指定block大小·)
    mke2fs 1.39 (29-May-2006)
    Filesystem label=
    OS type: Linux
    Block size=1024 (log=0)
    Fragment size=1024 (log=0)
    inodes, 104388 blocks
    blocks (5.00%) reserved for the super user
    First data block=1
    Maximum filesystem blocks=67371008
    block groups
    blocks per group, 8192 fragments per group
    inodes per group
    Superblock backups stored on blocks: 
            8193, 24577, 40961, 57345, 73729
    
    Writing inode tables: done                            
    Creating journal (4096 blocks): done
    Writing superblocks and filesystem accounting information: done
    
    This filesystem will be automatically checked every 23 mounts or
    days, whichever comes first.  Use tune2fs -c or -i to override.
    
    5、[root@test6 ~]# mount /dev/sda6 /mnt/sda7/  //进行挂载使用
    anaconda-ks.cfg  install.log  install.log.syslog/
    6、[root@test6
    ~]# df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/sda5 9.7G 1.1G 8.1G 12% / /dev/sda1 99M 12M 83M 13% /boot tmpfs 252M 0 252M 0% /dev/shm /dev/hdc 3.9G 3.9G 0 100% /mnt/cdrom /dev/sda6 99M 5.6M 89M 6% /mnt/sda7
  • 相关阅读:
    SAP系统和微信集成的系列教程之十:如何在SAP C4C系统里直接回复消息给微信用户
    SAP系统和微信集成的系列教程之九:如何将微信用户发送给微信公众号的内容自动转存到SAP C4C系统
    SAP系统和微信集成的系列教程之八:100行代码在微信公众号里集成地图搜索功能
    漫谈SAP产品里页面上的Checkbox设计与实现系列之一
    一个SAP成都研究院开发工程师的2020年度总结:未知生,焉知死
    Angular form控件原生HTML代码里ng-reflect-form属性和其值的生成时机
    一个SAP成都研究院开发工程师2020年所有文章列表
    SAP系统和微信集成的系列教程之七:使用Redis存储微信用户和公众号的对话记录
    用shell脚本从git上拉取,项目目录下所有各个子项目代码
    shell脚本小计
  • 原文地址:https://www.cnblogs.com/kcxg/p/10514898.html
Copyright © 2011-2022 走看看