Does pvcreate destroy all the data in a partition?












-3















man pvcreate says




pvcreate initializes a PV so that it is recognized as belonging to LVM, and allows the PV to be
used in a VG. A PV can be a disk partition, whole disk, meta device, or loopback file.



For DOS disk partitions, the partition id should be set to 0x8e using fdisk(8), cfdisk(8), or a
equivalent. For GUID Partition Table (GPT), the id is E6D6D379-F507-44C2-A23C-
238F2A3DF928. For whole disk devices only the partition table must be erased, which will
effectively destroy all data on that disk. This can be done by zeroing the first sector with:



dd if=/dev/zero of=PhysicalVolume bs=512 count=1




If I use pvcreate to mark a disk as a PV, does it mean that pvcreate will destroy all the data on a disk?



If I use pvcreate to mark a partition which contains a filesystem as a PV as a PV, will it destroy all the data in the filesystem?
If yes, does it mean that I can't move a filesystem from a partition to a LV, by pvcreate the partition as a PV (and then lvcreate a LV)?



Thanks.










share|improve this question




















  • 1





    What do you mean by "mark the disk as a PV"? Formatting an existing device as a PV will effectively lose said data in the same way that reformating a filesystem with a new filesystem will lose previous files.

    – Torin
    Feb 24 at 16:05













  • What do you mean? Marking a device as a PV is not reformating a filesystem with a new filesystem.

    – Tim
    Feb 24 at 16:24













  • Both involve removing the structure of a volume and replacing it with a new structure. You don't make a physical volume by "marking" it as such in the same way you don't make a filesystem by "marking" it - it needs formatting

    – Torin
    Feb 24 at 16:29






  • 1





    pvcreate writes a header block. This may effectively make the data structures (eg the filesystem superblock) unreadable, but the underlying data may be recoverable by a data recovery tool, or by dd. From a typical end-user perspective, doing pvcreate on a block device may render the existing filesystem unreadable.

    – Stephen Harris
    Feb 24 at 16:35
















-3















man pvcreate says




pvcreate initializes a PV so that it is recognized as belonging to LVM, and allows the PV to be
used in a VG. A PV can be a disk partition, whole disk, meta device, or loopback file.



For DOS disk partitions, the partition id should be set to 0x8e using fdisk(8), cfdisk(8), or a
equivalent. For GUID Partition Table (GPT), the id is E6D6D379-F507-44C2-A23C-
238F2A3DF928. For whole disk devices only the partition table must be erased, which will
effectively destroy all data on that disk. This can be done by zeroing the first sector with:



dd if=/dev/zero of=PhysicalVolume bs=512 count=1




If I use pvcreate to mark a disk as a PV, does it mean that pvcreate will destroy all the data on a disk?



If I use pvcreate to mark a partition which contains a filesystem as a PV as a PV, will it destroy all the data in the filesystem?
If yes, does it mean that I can't move a filesystem from a partition to a LV, by pvcreate the partition as a PV (and then lvcreate a LV)?



Thanks.










share|improve this question




















  • 1





    What do you mean by "mark the disk as a PV"? Formatting an existing device as a PV will effectively lose said data in the same way that reformating a filesystem with a new filesystem will lose previous files.

    – Torin
    Feb 24 at 16:05













  • What do you mean? Marking a device as a PV is not reformating a filesystem with a new filesystem.

    – Tim
    Feb 24 at 16:24













  • Both involve removing the structure of a volume and replacing it with a new structure. You don't make a physical volume by "marking" it as such in the same way you don't make a filesystem by "marking" it - it needs formatting

    – Torin
    Feb 24 at 16:29






  • 1





    pvcreate writes a header block. This may effectively make the data structures (eg the filesystem superblock) unreadable, but the underlying data may be recoverable by a data recovery tool, or by dd. From a typical end-user perspective, doing pvcreate on a block device may render the existing filesystem unreadable.

    – Stephen Harris
    Feb 24 at 16:35














-3












-3








-3








man pvcreate says




pvcreate initializes a PV so that it is recognized as belonging to LVM, and allows the PV to be
used in a VG. A PV can be a disk partition, whole disk, meta device, or loopback file.



For DOS disk partitions, the partition id should be set to 0x8e using fdisk(8), cfdisk(8), or a
equivalent. For GUID Partition Table (GPT), the id is E6D6D379-F507-44C2-A23C-
238F2A3DF928. For whole disk devices only the partition table must be erased, which will
effectively destroy all data on that disk. This can be done by zeroing the first sector with:



dd if=/dev/zero of=PhysicalVolume bs=512 count=1




If I use pvcreate to mark a disk as a PV, does it mean that pvcreate will destroy all the data on a disk?



If I use pvcreate to mark a partition which contains a filesystem as a PV as a PV, will it destroy all the data in the filesystem?
If yes, does it mean that I can't move a filesystem from a partition to a LV, by pvcreate the partition as a PV (and then lvcreate a LV)?



Thanks.










share|improve this question
















man pvcreate says




pvcreate initializes a PV so that it is recognized as belonging to LVM, and allows the PV to be
used in a VG. A PV can be a disk partition, whole disk, meta device, or loopback file.



For DOS disk partitions, the partition id should be set to 0x8e using fdisk(8), cfdisk(8), or a
equivalent. For GUID Partition Table (GPT), the id is E6D6D379-F507-44C2-A23C-
238F2A3DF928. For whole disk devices only the partition table must be erased, which will
effectively destroy all data on that disk. This can be done by zeroing the first sector with:



dd if=/dev/zero of=PhysicalVolume bs=512 count=1




If I use pvcreate to mark a disk as a PV, does it mean that pvcreate will destroy all the data on a disk?



If I use pvcreate to mark a partition which contains a filesystem as a PV as a PV, will it destroy all the data in the filesystem?
If yes, does it mean that I can't move a filesystem from a partition to a LV, by pvcreate the partition as a PV (and then lvcreate a LV)?



Thanks.







lvm






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 24 at 16:44







Tim

















asked Feb 24 at 15:56









TimTim

27.8k78265485




27.8k78265485








  • 1





    What do you mean by "mark the disk as a PV"? Formatting an existing device as a PV will effectively lose said data in the same way that reformating a filesystem with a new filesystem will lose previous files.

    – Torin
    Feb 24 at 16:05













  • What do you mean? Marking a device as a PV is not reformating a filesystem with a new filesystem.

    – Tim
    Feb 24 at 16:24













  • Both involve removing the structure of a volume and replacing it with a new structure. You don't make a physical volume by "marking" it as such in the same way you don't make a filesystem by "marking" it - it needs formatting

    – Torin
    Feb 24 at 16:29






  • 1





    pvcreate writes a header block. This may effectively make the data structures (eg the filesystem superblock) unreadable, but the underlying data may be recoverable by a data recovery tool, or by dd. From a typical end-user perspective, doing pvcreate on a block device may render the existing filesystem unreadable.

    – Stephen Harris
    Feb 24 at 16:35














  • 1





    What do you mean by "mark the disk as a PV"? Formatting an existing device as a PV will effectively lose said data in the same way that reformating a filesystem with a new filesystem will lose previous files.

    – Torin
    Feb 24 at 16:05













  • What do you mean? Marking a device as a PV is not reformating a filesystem with a new filesystem.

    – Tim
    Feb 24 at 16:24













  • Both involve removing the structure of a volume and replacing it with a new structure. You don't make a physical volume by "marking" it as such in the same way you don't make a filesystem by "marking" it - it needs formatting

    – Torin
    Feb 24 at 16:29






  • 1





    pvcreate writes a header block. This may effectively make the data structures (eg the filesystem superblock) unreadable, but the underlying data may be recoverable by a data recovery tool, or by dd. From a typical end-user perspective, doing pvcreate on a block device may render the existing filesystem unreadable.

    – Stephen Harris
    Feb 24 at 16:35








1




1





What do you mean by "mark the disk as a PV"? Formatting an existing device as a PV will effectively lose said data in the same way that reformating a filesystem with a new filesystem will lose previous files.

– Torin
Feb 24 at 16:05







What do you mean by "mark the disk as a PV"? Formatting an existing device as a PV will effectively lose said data in the same way that reformating a filesystem with a new filesystem will lose previous files.

– Torin
Feb 24 at 16:05















What do you mean? Marking a device as a PV is not reformating a filesystem with a new filesystem.

– Tim
Feb 24 at 16:24







What do you mean? Marking a device as a PV is not reformating a filesystem with a new filesystem.

– Tim
Feb 24 at 16:24















Both involve removing the structure of a volume and replacing it with a new structure. You don't make a physical volume by "marking" it as such in the same way you don't make a filesystem by "marking" it - it needs formatting

– Torin
Feb 24 at 16:29





Both involve removing the structure of a volume and replacing it with a new structure. You don't make a physical volume by "marking" it as such in the same way you don't make a filesystem by "marking" it - it needs formatting

– Torin
Feb 24 at 16:29




1




1





pvcreate writes a header block. This may effectively make the data structures (eg the filesystem superblock) unreadable, but the underlying data may be recoverable by a data recovery tool, or by dd. From a typical end-user perspective, doing pvcreate on a block device may render the existing filesystem unreadable.

– Stephen Harris
Feb 24 at 16:35





pvcreate writes a header block. This may effectively make the data structures (eg the filesystem superblock) unreadable, but the underlying data may be recoverable by a data recovery tool, or by dd. From a typical end-user perspective, doing pvcreate on a block device may render the existing filesystem unreadable.

– Stephen Harris
Feb 24 at 16:35










1 Answer
1






active

oldest

votes


















1















Does it say that pvcreate will destroy all the data on a disk,




No, I read all the quotes in your question, and it does not say this.



Never pvcreate, not mkfs, will securely delete a partition. They do not write to much of the partition. They only write what they need to, the rest is ignored.



When the OS reads this partition, it will see what type it is, and only follow links to initialised data, the rest with old stuff will be ignored. However if you choose to read it in a different way (forensic analysis), then you can see much of what was there before).



However



While we can not trust them to remove data, we also cannot trust them not to write over data. They write what they need to, this could over-right important data.



Is there a way to convert from one file-system/PV to another?



I don't know. It depends what you are converting to what.






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f502710%2fdoes-pvcreate-destroy-all-the-data-in-a-partition%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1















    Does it say that pvcreate will destroy all the data on a disk,




    No, I read all the quotes in your question, and it does not say this.



    Never pvcreate, not mkfs, will securely delete a partition. They do not write to much of the partition. They only write what they need to, the rest is ignored.



    When the OS reads this partition, it will see what type it is, and only follow links to initialised data, the rest with old stuff will be ignored. However if you choose to read it in a different way (forensic analysis), then you can see much of what was there before).



    However



    While we can not trust them to remove data, we also cannot trust them not to write over data. They write what they need to, this could over-right important data.



    Is there a way to convert from one file-system/PV to another?



    I don't know. It depends what you are converting to what.






    share|improve this answer




























      1















      Does it say that pvcreate will destroy all the data on a disk,




      No, I read all the quotes in your question, and it does not say this.



      Never pvcreate, not mkfs, will securely delete a partition. They do not write to much of the partition. They only write what they need to, the rest is ignored.



      When the OS reads this partition, it will see what type it is, and only follow links to initialised data, the rest with old stuff will be ignored. However if you choose to read it in a different way (forensic analysis), then you can see much of what was there before).



      However



      While we can not trust them to remove data, we also cannot trust them not to write over data. They write what they need to, this could over-right important data.



      Is there a way to convert from one file-system/PV to another?



      I don't know. It depends what you are converting to what.






      share|improve this answer


























        1












        1








        1








        Does it say that pvcreate will destroy all the data on a disk,




        No, I read all the quotes in your question, and it does not say this.



        Never pvcreate, not mkfs, will securely delete a partition. They do not write to much of the partition. They only write what they need to, the rest is ignored.



        When the OS reads this partition, it will see what type it is, and only follow links to initialised data, the rest with old stuff will be ignored. However if you choose to read it in a different way (forensic analysis), then you can see much of what was there before).



        However



        While we can not trust them to remove data, we also cannot trust them not to write over data. They write what they need to, this could over-right important data.



        Is there a way to convert from one file-system/PV to another?



        I don't know. It depends what you are converting to what.






        share|improve this answer














        Does it say that pvcreate will destroy all the data on a disk,




        No, I read all the quotes in your question, and it does not say this.



        Never pvcreate, not mkfs, will securely delete a partition. They do not write to much of the partition. They only write what they need to, the rest is ignored.



        When the OS reads this partition, it will see what type it is, and only follow links to initialised data, the rest with old stuff will be ignored. However if you choose to read it in a different way (forensic analysis), then you can see much of what was there before).



        However



        While we can not trust them to remove data, we also cannot trust them not to write over data. They write what they need to, this could over-right important data.



        Is there a way to convert from one file-system/PV to another?



        I don't know. It depends what you are converting to what.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 24 at 16:44









        ctrl-alt-delorctrl-alt-delor

        12k42360




        12k42360






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f502710%2fdoes-pvcreate-destroy-all-the-data-in-a-partition%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to make a Squid Proxy server?

            第一次世界大戦

            Touch on Surface Book