How to TRIM a pre Windows 2008 server with boot CD?












1















I need to TRIM some NTFS disks where the OS itself is not capable.
The disks are served by a ceph cluster to KVM, where Server 2008 is running.



Why?
This server is going out of business and I will export the disks to qcow2 (sparse, skip zeros).
This only works, if empty data areas are realy empty (like SSD TRIM). This is the case for newser OSs. Discard support is enabled in KVM.



Sdelete is no solution, as it is only able to write zeros and I need to detect zeros in KVM. This also takes much more time an I/O.



Is there some kind of boot disk which is based on a new OS and has the windows defrag tool (which is TRIM capable) onboard?










share|improve this question























  • Windows To Go comes to mind.

    – gronostaj
    Dec 19 '18 at 10:57











  • @gronostaj good idea, never used it but might be capable. I will try it now.

    – Kevin
    Dec 19 '18 at 11:02











  • What type are the disks themselves? Do they in fact support TRIM at all?

    – grawity
    Dec 19 '18 at 12:04











  • @grawity the disks are RBD via Ceph (block storage on object storage). They are attached to Linux KVM hypervisor (VMs). Disk type is SCSI (VirtIO SCSI with discard support).

    – Kevin
    Dec 19 '18 at 12:07













  • TRIM alone does not guarantee a sector will return zeros when read after being TRIMed, it depends on RZAT and DRAT support on the SSD, and even then not all SSD's support those synchronously. If you need to ensure maximum compression of the drive image, I would defrag first, disable NTFS compression and fill the remaining space with a file full of zeros, sync the filesystem, then remove the file.

    – matja
    Dec 19 '18 at 13:28


















1















I need to TRIM some NTFS disks where the OS itself is not capable.
The disks are served by a ceph cluster to KVM, where Server 2008 is running.



Why?
This server is going out of business and I will export the disks to qcow2 (sparse, skip zeros).
This only works, if empty data areas are realy empty (like SSD TRIM). This is the case for newser OSs. Discard support is enabled in KVM.



Sdelete is no solution, as it is only able to write zeros and I need to detect zeros in KVM. This also takes much more time an I/O.



Is there some kind of boot disk which is based on a new OS and has the windows defrag tool (which is TRIM capable) onboard?










share|improve this question























  • Windows To Go comes to mind.

    – gronostaj
    Dec 19 '18 at 10:57











  • @gronostaj good idea, never used it but might be capable. I will try it now.

    – Kevin
    Dec 19 '18 at 11:02











  • What type are the disks themselves? Do they in fact support TRIM at all?

    – grawity
    Dec 19 '18 at 12:04











  • @grawity the disks are RBD via Ceph (block storage on object storage). They are attached to Linux KVM hypervisor (VMs). Disk type is SCSI (VirtIO SCSI with discard support).

    – Kevin
    Dec 19 '18 at 12:07













  • TRIM alone does not guarantee a sector will return zeros when read after being TRIMed, it depends on RZAT and DRAT support on the SSD, and even then not all SSD's support those synchronously. If you need to ensure maximum compression of the drive image, I would defrag first, disable NTFS compression and fill the remaining space with a file full of zeros, sync the filesystem, then remove the file.

    – matja
    Dec 19 '18 at 13:28
















1












1








1








I need to TRIM some NTFS disks where the OS itself is not capable.
The disks are served by a ceph cluster to KVM, where Server 2008 is running.



Why?
This server is going out of business and I will export the disks to qcow2 (sparse, skip zeros).
This only works, if empty data areas are realy empty (like SSD TRIM). This is the case for newser OSs. Discard support is enabled in KVM.



Sdelete is no solution, as it is only able to write zeros and I need to detect zeros in KVM. This also takes much more time an I/O.



Is there some kind of boot disk which is based on a new OS and has the windows defrag tool (which is TRIM capable) onboard?










share|improve this question














I need to TRIM some NTFS disks where the OS itself is not capable.
The disks are served by a ceph cluster to KVM, where Server 2008 is running.



Why?
This server is going out of business and I will export the disks to qcow2 (sparse, skip zeros).
This only works, if empty data areas are realy empty (like SSD TRIM). This is the case for newser OSs. Discard support is enabled in KVM.



Sdelete is no solution, as it is only able to write zeros and I need to detect zeros in KVM. This also takes much more time an I/O.



Is there some kind of boot disk which is based on a new OS and has the windows defrag tool (which is TRIM capable) onboard?







trim






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 19 '18 at 10:52









KevinKevin

61




61













  • Windows To Go comes to mind.

    – gronostaj
    Dec 19 '18 at 10:57











  • @gronostaj good idea, never used it but might be capable. I will try it now.

    – Kevin
    Dec 19 '18 at 11:02











  • What type are the disks themselves? Do they in fact support TRIM at all?

    – grawity
    Dec 19 '18 at 12:04











  • @grawity the disks are RBD via Ceph (block storage on object storage). They are attached to Linux KVM hypervisor (VMs). Disk type is SCSI (VirtIO SCSI with discard support).

    – Kevin
    Dec 19 '18 at 12:07













  • TRIM alone does not guarantee a sector will return zeros when read after being TRIMed, it depends on RZAT and DRAT support on the SSD, and even then not all SSD's support those synchronously. If you need to ensure maximum compression of the drive image, I would defrag first, disable NTFS compression and fill the remaining space with a file full of zeros, sync the filesystem, then remove the file.

    – matja
    Dec 19 '18 at 13:28





















  • Windows To Go comes to mind.

    – gronostaj
    Dec 19 '18 at 10:57











  • @gronostaj good idea, never used it but might be capable. I will try it now.

    – Kevin
    Dec 19 '18 at 11:02











  • What type are the disks themselves? Do they in fact support TRIM at all?

    – grawity
    Dec 19 '18 at 12:04











  • @grawity the disks are RBD via Ceph (block storage on object storage). They are attached to Linux KVM hypervisor (VMs). Disk type is SCSI (VirtIO SCSI with discard support).

    – Kevin
    Dec 19 '18 at 12:07













  • TRIM alone does not guarantee a sector will return zeros when read after being TRIMed, it depends on RZAT and DRAT support on the SSD, and even then not all SSD's support those synchronously. If you need to ensure maximum compression of the drive image, I would defrag first, disable NTFS compression and fill the remaining space with a file full of zeros, sync the filesystem, then remove the file.

    – matja
    Dec 19 '18 at 13:28



















Windows To Go comes to mind.

– gronostaj
Dec 19 '18 at 10:57





Windows To Go comes to mind.

– gronostaj
Dec 19 '18 at 10:57













@gronostaj good idea, never used it but might be capable. I will try it now.

– Kevin
Dec 19 '18 at 11:02





@gronostaj good idea, never used it but might be capable. I will try it now.

– Kevin
Dec 19 '18 at 11:02













What type are the disks themselves? Do they in fact support TRIM at all?

– grawity
Dec 19 '18 at 12:04





What type are the disks themselves? Do they in fact support TRIM at all?

– grawity
Dec 19 '18 at 12:04













@grawity the disks are RBD via Ceph (block storage on object storage). They are attached to Linux KVM hypervisor (VMs). Disk type is SCSI (VirtIO SCSI with discard support).

– Kevin
Dec 19 '18 at 12:07







@grawity the disks are RBD via Ceph (block storage on object storage). They are attached to Linux KVM hypervisor (VMs). Disk type is SCSI (VirtIO SCSI with discard support).

– Kevin
Dec 19 '18 at 12:07















TRIM alone does not guarantee a sector will return zeros when read after being TRIMed, it depends on RZAT and DRAT support on the SSD, and even then not all SSD's support those synchronously. If you need to ensure maximum compression of the drive image, I would defrag first, disable NTFS compression and fill the remaining space with a file full of zeros, sync the filesystem, then remove the file.

– matja
Dec 19 '18 at 13:28







TRIM alone does not guarantee a sector will return zeros when read after being TRIMed, it depends on RZAT and DRAT support on the SSD, and even then not all SSD's support those synchronously. If you need to ensure maximum compression of the drive image, I would defrag first, disable NTFS compression and fill the remaining space with a file full of zeros, sync the filesystem, then remove the file.

– matja
Dec 19 '18 at 13:28












1 Answer
1






active

oldest

votes


















1














Attach the disks to a Linux system with recent ntfs-3g (e.g. the Arch Linux or GParted live-CDs should work; make sure to grab the latest version). Mount them somewhere, and run fstrim to do the job.



# lsblk -f
# mount -t ntfs-3g /dev/sdc1 /mnt
# fstrim -v /mnt


Alternatively: use ntfsclone to directly make a raw sparse image, then convert it to qcow2. (Ntfsclone outputs a raw image which looks like full-size, but unused areas will be skipped and it will be sparse at filesystem level. Qemu-img doesn't know that, but it will detect zeros during conversion according to the description of -S.)



# ntfsclone /dev/rbdsomethingorother -o server.raw
# qemu-img convert server.raw -O qcow2 server.qcow2





share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    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: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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%2fsuperuser.com%2fquestions%2f1385877%2fhow-to-trim-a-pre-windows-2008-server-with-boot-cd%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














    Attach the disks to a Linux system with recent ntfs-3g (e.g. the Arch Linux or GParted live-CDs should work; make sure to grab the latest version). Mount them somewhere, and run fstrim to do the job.



    # lsblk -f
    # mount -t ntfs-3g /dev/sdc1 /mnt
    # fstrim -v /mnt


    Alternatively: use ntfsclone to directly make a raw sparse image, then convert it to qcow2. (Ntfsclone outputs a raw image which looks like full-size, but unused areas will be skipped and it will be sparse at filesystem level. Qemu-img doesn't know that, but it will detect zeros during conversion according to the description of -S.)



    # ntfsclone /dev/rbdsomethingorother -o server.raw
    # qemu-img convert server.raw -O qcow2 server.qcow2





    share|improve this answer




























      1














      Attach the disks to a Linux system with recent ntfs-3g (e.g. the Arch Linux or GParted live-CDs should work; make sure to grab the latest version). Mount them somewhere, and run fstrim to do the job.



      # lsblk -f
      # mount -t ntfs-3g /dev/sdc1 /mnt
      # fstrim -v /mnt


      Alternatively: use ntfsclone to directly make a raw sparse image, then convert it to qcow2. (Ntfsclone outputs a raw image which looks like full-size, but unused areas will be skipped and it will be sparse at filesystem level. Qemu-img doesn't know that, but it will detect zeros during conversion according to the description of -S.)



      # ntfsclone /dev/rbdsomethingorother -o server.raw
      # qemu-img convert server.raw -O qcow2 server.qcow2





      share|improve this answer


























        1












        1








        1







        Attach the disks to a Linux system with recent ntfs-3g (e.g. the Arch Linux or GParted live-CDs should work; make sure to grab the latest version). Mount them somewhere, and run fstrim to do the job.



        # lsblk -f
        # mount -t ntfs-3g /dev/sdc1 /mnt
        # fstrim -v /mnt


        Alternatively: use ntfsclone to directly make a raw sparse image, then convert it to qcow2. (Ntfsclone outputs a raw image which looks like full-size, but unused areas will be skipped and it will be sparse at filesystem level. Qemu-img doesn't know that, but it will detect zeros during conversion according to the description of -S.)



        # ntfsclone /dev/rbdsomethingorother -o server.raw
        # qemu-img convert server.raw -O qcow2 server.qcow2





        share|improve this answer













        Attach the disks to a Linux system with recent ntfs-3g (e.g. the Arch Linux or GParted live-CDs should work; make sure to grab the latest version). Mount them somewhere, and run fstrim to do the job.



        # lsblk -f
        # mount -t ntfs-3g /dev/sdc1 /mnt
        # fstrim -v /mnt


        Alternatively: use ntfsclone to directly make a raw sparse image, then convert it to qcow2. (Ntfsclone outputs a raw image which looks like full-size, but unused areas will be skipped and it will be sparse at filesystem level. Qemu-img doesn't know that, but it will detect zeros during conversion according to the description of -S.)



        # ntfsclone /dev/rbdsomethingorother -o server.raw
        # qemu-img convert server.raw -O qcow2 server.qcow2






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 19 '18 at 12:27









        grawitygrawity

        233k36494549




        233k36494549






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • 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%2fsuperuser.com%2fquestions%2f1385877%2fhow-to-trim-a-pre-windows-2008-server-with-boot-cd%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