• Linux磁盘分区(二):删除


    ***********************************************声明************************************************ 

    原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明出处(http://blog.csdn.net/huangyanlong)。

    表述有错误之处,请您留言或邮件(hyldba@163.com)指明,不胜感激。

    *****************************************************************************************************

    续接上篇:“举例:将sdb1格式化为ext3文件系统”点击打开链接

    *****************************************************************************************************
    Linux硬盘分区(二):删除

    *****************************************************************************************************


    *************************
    举例:对sdb1进行umount

    *************************

    1. [root@hyl /]# df -h  
    2. Filesystem            Size  Used Avail Use% Mounted on  
    3. /dev/sda1             9.7G  5.4G  3.9G  59% /  
    4. /dev/sda3              35G   17G   17G  50% /home  
    5. tmpfs                1006M     0 1006M   0% /dev/shm  
    6. /dev/sdb1             1.9G   35M  1.8G   2% /data1  
    7. [root@hyl /]# umount /data1  
    8. [root@hyl /]# df -h  
    9. Filesystem            Size  Used Avail Use% Mounted on  
    10. /dev/sda1             9.7G  5.4G  3.9G  59% /  
    11. /dev/sda3              35G   17G   17G  50% /home  
    12. tmpfs                1006M     0 1006M   0% /dev/shm  
    13.   
    14. [root@hyl /]# fdisk -l  
    15.   
    16. Disk /dev/sda: 53.6 GB, 53687091200 bytes  
    17. 255 heads, 63 sectors/track, 6527 cylinders  
    18. Units = cylinders of 16065 * 512 = 8225280 bytes  
    19.   
    20.    Device Boot      Start         End      Blocks   Id  System  
    21. /dev/sda1   *           1        1305    10482381   83  Linux  
    22. /dev/sda2            1306        1827     4192965   82  Linux swap / Solaris  
    23. /dev/sda3            1828        6527    37752750   83  Linux  
    24.   
    25. Disk /dev/sdb: 10.7 GB, 10737418240 bytes  
    26. 255 heads, 63 sectors/track, 1305 cylinders  
    27. Units = cylinders of 16065 * 512 = 8225280 bytes  
    28.   
    29.    Device Boot      Start         End      Blocks   Id  System  
    30. /dev/sdb1               1         250     2008093+  83  Linux  
    31. /dev/sdb2             251         500     2008125   83  Linux  
    32. /dev/sdb3             501         750     2008125   83  Linux  
    33. /dev/sdb4             751        1305     4458037+   5  Extended  
    34. /dev/sdb5             751         875     1004031   83  Linux  
    35. /dev/sdb6             876        1000     1004031   83  Linux  
    36. /dev/sdb7            1001        1305     2449881   83  Linux  

    *************************
    对第二块磁盘操作(即/dev/sdb)
    *************************

    1. [root@hyl /]# fdisk /dev/sdb  
    2.   
    3. The number of cylinders for this disk is set to 1305.  
    4. There is nothing wrong with that, but this is larger than 1024,  
    5. and could in certain setups cause problems with:  
    6. 1) software that runs at boot time (e.g., old versions of LILO)  
    7. 2) booting and partitioning software from other OSs  
    8.    (e.g., DOS FDISK, OS/2 FDISK)  
    9.   
    10. Command (m for help): m  
    11. Command action  
    12.    a   toggle a bootable flag  
    13.    b   edit bsd disklabel  
    14.    c   toggle the dos compatibility flag  
    15.    d   delete a partition  
    16.    l   list known partition types  
    17.    m   print this menu  
    18.    n   add a new partition  
    19.    o   create a new empty DOS partition table  
    20.    p   print the partition table  
    21.    q   quit without saving changes  
    22.    s   create a new empty Sun disklabel  
    23.    t   change a partition's system id  
    24.    u   change display/entry units  
    25.    v   verify the partition table  
    26.    w   write table to disk and exit  
    27.    x   extra functionality (experts only)  
    28.   
    29.   
    30. Command (m for help): p  
    31.   
    32. Disk /dev/sdb: 10.7 GB, 10737418240 bytes  
    33. 255 heads, 63 sectors/track, 1305 cylinders  
    34. Units = cylinders of 16065 * 512 = 8225280 bytes  
    35.   
    36.    Device Boot      Start         End      Blocks   Id  System  
    37. /dev/sdb1               1         250     2008093+  83  Linux  
    38. /dev/sdb2             251         500     2008125   83  Linux  
    39. /dev/sdb3             501         750     2008125   83  Linux  
    40. /dev/sdb4             751        1305     4458037+   5  Extended  
    41. /dev/sdb5             751         875     1004031   83  Linux  
    42. /dev/sdb6             876        1000     1004031   83  Linux  
    43. /dev/sdb7            1001        1305     2449881   83  Linux  
    44. </span>  

    *************************
    删除分区:sdb1及其它
    *************************

    1. Command (m for help): d  
    2. --输入删除指令  
    3. Partition number (1-7): 1  
    4. --输入删除的分区号  
    5. Command (m for help): p  
    6. --打印分区表  
    7. Disk /dev/sdb: 10.7 GB, 10737418240 bytes  
    8. 255 heads, 63 sectors/track, 1305 cylinders  
    9. Units = cylinders of 16065 * 512 = 8225280 bytes  
    10.   
    11.   
    12.    Device Boot      Start         End      Blocks   Id  System  
    13. /dev/sdb2             251         500     2008125   83  Linux  
    14. /dev/sdb3             501         750     2008125   83  Linux  
    15. /dev/sdb4             751        1305     4458037+   5  Extended  
    16. /dev/sdb5             751         875     1004031   83  Linux  
    17. /dev/sdb6             876        1000     1004031   83  Linux  
    18. /dev/sdb7            1001        1305     2449881   83  Linux  
    19. --可以看到sdb1已经被删除了  
    20. --接下来同理,删除其它分区  
    21. Command (m for help): d  
    22. Partition number (1-7): 2  
    23.   
    24.   
    25. Command (m for help): d  
    26. Partition number (1-7): 3  
    27.   
    28.   
    29. Command (m for help): d  
    30. Partition number (1-7): 4  
    31.   
    32.   
    33. Command (m for help): p   
    34.   
    35.   
    36. Disk /dev/sdb: 10.7 GB, 10737418240 bytes  
    37. 255 heads, 63 sectors/track, 1305 cylinders  
    38. Units = cylinders of 16065 * 512 = 8225280 bytes  
    39.   
    40.   
    41.    Device Boot      Start         End      Blocks   Id  System  
    42.   
    43.   
    44. Command (m for help): w  
    45. --保存退出  
    46. The partition table has been altered!  
    47.   
    48.   
    49. Calling ioctl() to re-read partition table.  
    50. Syncing disks.  
    51.   
    52.   
    53. --现在可以移除磁盘了  


    ***********************************************声明************************************************ 

    原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明出处(http://blog.csdn.net/huangyanlong)。

    表述有错误之处,请您留言或邮件(hyldba@163.com)指明,不胜感激。

    *****************************************************************************************************

  • 相关阅读:
    [入门到吐槽系列] 微信小程序 上传图片 前端压缩 保存到云存储 使用Canvas新API的巨坑!
    [入门到吐槽系列] Webix 10分钟入门 一 管理后台制作
    使用Spring提供的BeanUtils.copyProperties()方法报错:Could not copy property 'xxx' from source to target
    记录一次 java.lang.IncompatibleClassChangeError: Implementing class
    centos 7下ifcfgens33网卡配置文件详解
    二进制方式安装搭建k8s集群
    Win10下VMware Workstation 16 Pro最小化安装CentOS 7
    单点登录协议有哪些?CAS、OAuth、OIDC、SAML有何异同? itprobie
    SQL2005禁用相关存储过程方法 itprobie
    .NET 6 创建 Console 项目使用旧程序样式
  • 原文地址:https://www.cnblogs.com/ghjbk/p/6992779.html
Copyright © 2020-2023  润新知