• How to clear/delete all the partition table from a disk or partition in Linux


    https://www.golinuxhub.com/2018/05/how-to-cleardelete-partition-table-disk-linux/

    Below article is a must read to understand all about partition, partition scheme and partition table

    Everything you need to know about a partition, types of partition, partition scheme

    To clear a partition table, wipefs command can be used

     

    Here I have a disk /dev/sdb which I have added to my Linux box for this article.
    In this disk I have created two primary partitions

    # fdisk -l /dev/sdb

    Disk /dev/sdb: 17.2 GB, 17179869184 bytes, 33554432 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 label type: dos
    Disk identifier: 0x1410600c

       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1            2048     4196351     2097152   83  Linux
    /dev/sdb2         4196352    10487807     3145728   83  Linux

    Now I would like to clear the partition table from this disk
    To do so below commands can be used

    Check the partition table

    # wipefs /dev/sdb
    offset               type
    —————————————————————-
    0x1fe                dos   [partition table]

    Here I have a dos partition table

    Clear the partition table

    Using the below command you can wipe “dos” partition table

    # wipefs -a -t dos -f /dev/sdb
    /dev/sdb: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
    /dev/sdb: calling ioclt to re-read partition table: Success

    If I had a GPT partition table then to clear the same

    # wipefs -a -t gpt -f /dev/sdb

    To clear all the partition tables

    # wipefs -a -f /dev/sdb

    You can also delete a partition table using the offset value as shown above

    # wipefs -o 0x1fe /dev/sdb

    Once the above command returns success, check the partition table using fdisk

    # fdisk -l /dev/sdb

    Disk /dev/sdb: 17.2 GB, 17179869184 bytes, 33554432 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

    As you both my partitions are cleared/deleted.

    Also read:
     

    I hope the article was useful.

  • 相关阅读:
    odoo service error 更改端口号
    unique 唯一约束
    odoo 注册失败
    odoo 某个字段权限设置
    linux 定时任务
    odoo webside theme
    js 杂记
    vue3入门总结
    vue输出空格
    css等比例缩放图片
  • 原文地址:https://www.cnblogs.com/dhcn/p/14280969.html
Copyright © 2020-2023  润新知