How can I remove a swap partition on FreeNAS?












0














I have a FreeNAS 11.1-U6 installation for testing purposes. It has two 500GB SSDs and one 4TB USB drive. I installed FreeNAS to ada0 (the first 500GB SSD) and set up a volume on da0 (the 4TB drive) with the ada1 (the second 500GB SSD) as an L2ARC.



That was all fine, but I wanted to restart from scratch. So, I deleted the volume (wiped it and treated it as "new"), and tried to create a new volume. That's when I hit some problems. When I tried to create a new volume, I got this error:



[MiddlewareError: Unable to GPT format the disk "da0": gpart: geom 'da0': File exists]


I did some reading and I found out how to delete partitions off of the drives, using gpart. I was able to clear da0, but not ada1:



[MiddlewareError: Unable to GPT format the disk "ada1": gpart: geom 'ada1': File exists]


But, I can't do what I did before with ada1, because I can't get rid of one of the partitions. Specifically, a swap partition.



root@stszfs:/ # gpart show ada1
=> 40 976773088 ada1 GPT (466G)
40 88 - free - (44K)
128 4194304 1 freebsd-swap (2.0G)
4194432 972578696 - free - (464G)


When I try to delete it, I get this:



root@stszfs:/ # gpart delete -i1 ada1
gpart: Device busy


When I try to destroy it, same thing:



root@stszfs:/ # gpart destroy -F ada1
gpart: Device busy


I still get this after running



swapoff -a


I also see in /etc/fstab I have this:



root@stszfs:/ # cat /etc/fstab
freenas-boot/grub /boot/grub zfs rw,noatime 1 0
fdescfs /dev/fd fdescfs rw 0 0
/dev/da0p1.eli none swap sw 0 0


I commented out the swap line and rebooted, and to no avail -- it was changed right back the way it was after a reboot. I can't find any evidence of any process using that swap partition. I tried using dd to destroy the drive, but that didn't work either:



root@stszfs:/ # dd if=/dev/zero of=/dev/ada1 bs=512
dd: /dev/ada1: Operation not permitted


So, a few questions. How did this swap partition get there? I was using this drive as L2ARC originally, so why does it suddenly have a swap partition there that can't be removed? How do I get rid of this pesky swap partition without booting to another OS to do it? (I don't have physical access to the box at the moment.)










share|improve this question



























    0














    I have a FreeNAS 11.1-U6 installation for testing purposes. It has two 500GB SSDs and one 4TB USB drive. I installed FreeNAS to ada0 (the first 500GB SSD) and set up a volume on da0 (the 4TB drive) with the ada1 (the second 500GB SSD) as an L2ARC.



    That was all fine, but I wanted to restart from scratch. So, I deleted the volume (wiped it and treated it as "new"), and tried to create a new volume. That's when I hit some problems. When I tried to create a new volume, I got this error:



    [MiddlewareError: Unable to GPT format the disk "da0": gpart: geom 'da0': File exists]


    I did some reading and I found out how to delete partitions off of the drives, using gpart. I was able to clear da0, but not ada1:



    [MiddlewareError: Unable to GPT format the disk "ada1": gpart: geom 'ada1': File exists]


    But, I can't do what I did before with ada1, because I can't get rid of one of the partitions. Specifically, a swap partition.



    root@stszfs:/ # gpart show ada1
    => 40 976773088 ada1 GPT (466G)
    40 88 - free - (44K)
    128 4194304 1 freebsd-swap (2.0G)
    4194432 972578696 - free - (464G)


    When I try to delete it, I get this:



    root@stszfs:/ # gpart delete -i1 ada1
    gpart: Device busy


    When I try to destroy it, same thing:



    root@stszfs:/ # gpart destroy -F ada1
    gpart: Device busy


    I still get this after running



    swapoff -a


    I also see in /etc/fstab I have this:



    root@stszfs:/ # cat /etc/fstab
    freenas-boot/grub /boot/grub zfs rw,noatime 1 0
    fdescfs /dev/fd fdescfs rw 0 0
    /dev/da0p1.eli none swap sw 0 0


    I commented out the swap line and rebooted, and to no avail -- it was changed right back the way it was after a reboot. I can't find any evidence of any process using that swap partition. I tried using dd to destroy the drive, but that didn't work either:



    root@stszfs:/ # dd if=/dev/zero of=/dev/ada1 bs=512
    dd: /dev/ada1: Operation not permitted


    So, a few questions. How did this swap partition get there? I was using this drive as L2ARC originally, so why does it suddenly have a swap partition there that can't be removed? How do I get rid of this pesky swap partition without booting to another OS to do it? (I don't have physical access to the box at the moment.)










    share|improve this question

























      0












      0








      0







      I have a FreeNAS 11.1-U6 installation for testing purposes. It has two 500GB SSDs and one 4TB USB drive. I installed FreeNAS to ada0 (the first 500GB SSD) and set up a volume on da0 (the 4TB drive) with the ada1 (the second 500GB SSD) as an L2ARC.



      That was all fine, but I wanted to restart from scratch. So, I deleted the volume (wiped it and treated it as "new"), and tried to create a new volume. That's when I hit some problems. When I tried to create a new volume, I got this error:



      [MiddlewareError: Unable to GPT format the disk "da0": gpart: geom 'da0': File exists]


      I did some reading and I found out how to delete partitions off of the drives, using gpart. I was able to clear da0, but not ada1:



      [MiddlewareError: Unable to GPT format the disk "ada1": gpart: geom 'ada1': File exists]


      But, I can't do what I did before with ada1, because I can't get rid of one of the partitions. Specifically, a swap partition.



      root@stszfs:/ # gpart show ada1
      => 40 976773088 ada1 GPT (466G)
      40 88 - free - (44K)
      128 4194304 1 freebsd-swap (2.0G)
      4194432 972578696 - free - (464G)


      When I try to delete it, I get this:



      root@stszfs:/ # gpart delete -i1 ada1
      gpart: Device busy


      When I try to destroy it, same thing:



      root@stszfs:/ # gpart destroy -F ada1
      gpart: Device busy


      I still get this after running



      swapoff -a


      I also see in /etc/fstab I have this:



      root@stszfs:/ # cat /etc/fstab
      freenas-boot/grub /boot/grub zfs rw,noatime 1 0
      fdescfs /dev/fd fdescfs rw 0 0
      /dev/da0p1.eli none swap sw 0 0


      I commented out the swap line and rebooted, and to no avail -- it was changed right back the way it was after a reboot. I can't find any evidence of any process using that swap partition. I tried using dd to destroy the drive, but that didn't work either:



      root@stszfs:/ # dd if=/dev/zero of=/dev/ada1 bs=512
      dd: /dev/ada1: Operation not permitted


      So, a few questions. How did this swap partition get there? I was using this drive as L2ARC originally, so why does it suddenly have a swap partition there that can't be removed? How do I get rid of this pesky swap partition without booting to another OS to do it? (I don't have physical access to the box at the moment.)










      share|improve this question













      I have a FreeNAS 11.1-U6 installation for testing purposes. It has two 500GB SSDs and one 4TB USB drive. I installed FreeNAS to ada0 (the first 500GB SSD) and set up a volume on da0 (the 4TB drive) with the ada1 (the second 500GB SSD) as an L2ARC.



      That was all fine, but I wanted to restart from scratch. So, I deleted the volume (wiped it and treated it as "new"), and tried to create a new volume. That's when I hit some problems. When I tried to create a new volume, I got this error:



      [MiddlewareError: Unable to GPT format the disk "da0": gpart: geom 'da0': File exists]


      I did some reading and I found out how to delete partitions off of the drives, using gpart. I was able to clear da0, but not ada1:



      [MiddlewareError: Unable to GPT format the disk "ada1": gpart: geom 'ada1': File exists]


      But, I can't do what I did before with ada1, because I can't get rid of one of the partitions. Specifically, a swap partition.



      root@stszfs:/ # gpart show ada1
      => 40 976773088 ada1 GPT (466G)
      40 88 - free - (44K)
      128 4194304 1 freebsd-swap (2.0G)
      4194432 972578696 - free - (464G)


      When I try to delete it, I get this:



      root@stszfs:/ # gpart delete -i1 ada1
      gpart: Device busy


      When I try to destroy it, same thing:



      root@stszfs:/ # gpart destroy -F ada1
      gpart: Device busy


      I still get this after running



      swapoff -a


      I also see in /etc/fstab I have this:



      root@stszfs:/ # cat /etc/fstab
      freenas-boot/grub /boot/grub zfs rw,noatime 1 0
      fdescfs /dev/fd fdescfs rw 0 0
      /dev/da0p1.eli none swap sw 0 0


      I commented out the swap line and rebooted, and to no avail -- it was changed right back the way it was after a reboot. I can't find any evidence of any process using that swap partition. I tried using dd to destroy the drive, but that didn't work either:



      root@stszfs:/ # dd if=/dev/zero of=/dev/ada1 bs=512
      dd: /dev/ada1: Operation not permitted


      So, a few questions. How did this swap partition get there? I was using this drive as L2ARC originally, so why does it suddenly have a swap partition there that can't be removed? How do I get rid of this pesky swap partition without booting to another OS to do it? (I don't have physical access to the box at the moment.)







      partitioning swap freenas






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 23 '18 at 21:57









      DuffDuff

      1014




      1014






















          1 Answer
          1






          active

          oldest

          votes


















          0














          This is what I had to do.



          CAUTION: these commands will destroy your partition tables without prompting! Make sure you input the correct disk device!





          1. Enable write to MBR or dd will return Operation not permitted:



            sysctl kern.geom.debugflags=0x10




          2. Wipe partition table. Replace DISK with the correct device.



            dd if=/dev/zero of=/dev/DISK bs=1m count=1




          3. Possibly optional: wipe the GPT backup partition table. Replace DISK with the correct device.



            dd if=/dev/zero of=/dev/DISK bs=1m oseek=`diskinfo DISK | awk '{print int($3 / (1024*1024)) - 4;}'`



          4. Reboot.



          The disk(s) should now be reusable in the GUI.






          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%2f1369374%2fhow-can-i-remove-a-swap-partition-on-freenas%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









            0














            This is what I had to do.



            CAUTION: these commands will destroy your partition tables without prompting! Make sure you input the correct disk device!





            1. Enable write to MBR or dd will return Operation not permitted:



              sysctl kern.geom.debugflags=0x10




            2. Wipe partition table. Replace DISK with the correct device.



              dd if=/dev/zero of=/dev/DISK bs=1m count=1




            3. Possibly optional: wipe the GPT backup partition table. Replace DISK with the correct device.



              dd if=/dev/zero of=/dev/DISK bs=1m oseek=`diskinfo DISK | awk '{print int($3 / (1024*1024)) - 4;}'`



            4. Reboot.



            The disk(s) should now be reusable in the GUI.






            share|improve this answer


























              0














              This is what I had to do.



              CAUTION: these commands will destroy your partition tables without prompting! Make sure you input the correct disk device!





              1. Enable write to MBR or dd will return Operation not permitted:



                sysctl kern.geom.debugflags=0x10




              2. Wipe partition table. Replace DISK with the correct device.



                dd if=/dev/zero of=/dev/DISK bs=1m count=1




              3. Possibly optional: wipe the GPT backup partition table. Replace DISK with the correct device.



                dd if=/dev/zero of=/dev/DISK bs=1m oseek=`diskinfo DISK | awk '{print int($3 / (1024*1024)) - 4;}'`



              4. Reboot.



              The disk(s) should now be reusable in the GUI.






              share|improve this answer
























                0












                0








                0






                This is what I had to do.



                CAUTION: these commands will destroy your partition tables without prompting! Make sure you input the correct disk device!





                1. Enable write to MBR or dd will return Operation not permitted:



                  sysctl kern.geom.debugflags=0x10




                2. Wipe partition table. Replace DISK with the correct device.



                  dd if=/dev/zero of=/dev/DISK bs=1m count=1




                3. Possibly optional: wipe the GPT backup partition table. Replace DISK with the correct device.



                  dd if=/dev/zero of=/dev/DISK bs=1m oseek=`diskinfo DISK | awk '{print int($3 / (1024*1024)) - 4;}'`



                4. Reboot.



                The disk(s) should now be reusable in the GUI.






                share|improve this answer












                This is what I had to do.



                CAUTION: these commands will destroy your partition tables without prompting! Make sure you input the correct disk device!





                1. Enable write to MBR or dd will return Operation not permitted:



                  sysctl kern.geom.debugflags=0x10




                2. Wipe partition table. Replace DISK with the correct device.



                  dd if=/dev/zero of=/dev/DISK bs=1m count=1




                3. Possibly optional: wipe the GPT backup partition table. Replace DISK with the correct device.



                  dd if=/dev/zero of=/dev/DISK bs=1m oseek=`diskinfo DISK | awk '{print int($3 / (1024*1024)) - 4;}'`



                4. Reboot.



                The disk(s) should now be reusable in the GUI.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 24 '18 at 21:18









                BrendonBrendon

                1




                1






























                    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.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • 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%2f1369374%2fhow-can-i-remove-a-swap-partition-on-freenas%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

                    Probability when a professor distributes a quiz and homework assignment to a class of n students.

                    Aardman Animations

                    Are they similar matrix