Is there any way to make a folder behave the same as /tmp/?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have a large folder with a few million files on my external hard drive that I have to delete. Using rm -rf works, but is very slow due to the sheer amount of files, and the size of the folder.



Files that are in /tmp/ seem to be deleted instantly on reboot, no matter how big they are or how many files there are. So I am wondering if it is possible to give a folder on an external drive the same attributes as, and make it behave in the same way as /tmp/.







share|improve this question
























    up vote
    0
    down vote

    favorite












    I have a large folder with a few million files on my external hard drive that I have to delete. Using rm -rf works, but is very slow due to the sheer amount of files, and the size of the folder.



    Files that are in /tmp/ seem to be deleted instantly on reboot, no matter how big they are or how many files there are. So I am wondering if it is possible to give a folder on an external drive the same attributes as, and make it behave in the same way as /tmp/.







    share|improve this question






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have a large folder with a few million files on my external hard drive that I have to delete. Using rm -rf works, but is very slow due to the sheer amount of files, and the size of the folder.



      Files that are in /tmp/ seem to be deleted instantly on reboot, no matter how big they are or how many files there are. So I am wondering if it is possible to give a folder on an external drive the same attributes as, and make it behave in the same way as /tmp/.







      share|improve this question












      I have a large folder with a few million files on my external hard drive that I have to delete. Using rm -rf works, but is very slow due to the sheer amount of files, and the size of the folder.



      Files that are in /tmp/ seem to be deleted instantly on reboot, no matter how big they are or how many files there are. So I am wondering if it is possible to give a folder on an external drive the same attributes as, and make it behave in the same way as /tmp/.









      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 15 at 19:31









      DisplayName

      4,25584272




      4,25584272




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote













          rm is only necessary because you want to delete one piece of data (a specific file), while leaving the rest of the data on the filesystem in place.



          If you segregate your data so that you can retire all the data at the same time, then you don't have to remove the pieces individually. You can discard (and probably recreate) the filesystem quickly.



          /tmp is often created using virtual memory as the storage space instead of a disk partition. When this is true, the data is not stable across reboots, so it is created (empty) at every boot.



          You can't do that with a folder, but you can create a separate filesystem and mount it at the location you want. When you're ready to expire the data, you need to unmount it, recreate it, then remount it. Should take a few seconds.






          share|improve this answer



























            up vote
            0
            down vote













            The difference in performance that you are seeing is likely because your /tmp directory is mounted in RAM as opposed to physical storage. You can check this with mount.



            Also different types of file systems have different performance impacts in certain operations. XFS should outperform ext4, as should btrfs.



            These links could be useful too:



            • Efficiently delete large directory containing thousands of files

            • Deleting billions of files from a directory while seeing the progress as well





            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',
              convertImagesToLinks: false,
              noModals: false,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              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%2f424451%2fis-there-any-way-to-make-a-folder-behave-the-same-as-tmp%23new-answer', 'question_page');

              );

              Post as a guest






























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              2
              down vote













              rm is only necessary because you want to delete one piece of data (a specific file), while leaving the rest of the data on the filesystem in place.



              If you segregate your data so that you can retire all the data at the same time, then you don't have to remove the pieces individually. You can discard (and probably recreate) the filesystem quickly.



              /tmp is often created using virtual memory as the storage space instead of a disk partition. When this is true, the data is not stable across reboots, so it is created (empty) at every boot.



              You can't do that with a folder, but you can create a separate filesystem and mount it at the location you want. When you're ready to expire the data, you need to unmount it, recreate it, then remount it. Should take a few seconds.






              share|improve this answer
























                up vote
                2
                down vote













                rm is only necessary because you want to delete one piece of data (a specific file), while leaving the rest of the data on the filesystem in place.



                If you segregate your data so that you can retire all the data at the same time, then you don't have to remove the pieces individually. You can discard (and probably recreate) the filesystem quickly.



                /tmp is often created using virtual memory as the storage space instead of a disk partition. When this is true, the data is not stable across reboots, so it is created (empty) at every boot.



                You can't do that with a folder, but you can create a separate filesystem and mount it at the location you want. When you're ready to expire the data, you need to unmount it, recreate it, then remount it. Should take a few seconds.






                share|improve this answer






















                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  rm is only necessary because you want to delete one piece of data (a specific file), while leaving the rest of the data on the filesystem in place.



                  If you segregate your data so that you can retire all the data at the same time, then you don't have to remove the pieces individually. You can discard (and probably recreate) the filesystem quickly.



                  /tmp is often created using virtual memory as the storage space instead of a disk partition. When this is true, the data is not stable across reboots, so it is created (empty) at every boot.



                  You can't do that with a folder, but you can create a separate filesystem and mount it at the location you want. When you're ready to expire the data, you need to unmount it, recreate it, then remount it. Should take a few seconds.






                  share|improve this answer












                  rm is only necessary because you want to delete one piece of data (a specific file), while leaving the rest of the data on the filesystem in place.



                  If you segregate your data so that you can retire all the data at the same time, then you don't have to remove the pieces individually. You can discard (and probably recreate) the filesystem quickly.



                  /tmp is often created using virtual memory as the storage space instead of a disk partition. When this is true, the data is not stable across reboots, so it is created (empty) at every boot.



                  You can't do that with a folder, but you can create a separate filesystem and mount it at the location you want. When you're ready to expire the data, you need to unmount it, recreate it, then remount it. Should take a few seconds.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 15 at 19:51









                  BowlOfRed

                  2,335612




                  2,335612






















                      up vote
                      0
                      down vote













                      The difference in performance that you are seeing is likely because your /tmp directory is mounted in RAM as opposed to physical storage. You can check this with mount.



                      Also different types of file systems have different performance impacts in certain operations. XFS should outperform ext4, as should btrfs.



                      These links could be useful too:



                      • Efficiently delete large directory containing thousands of files

                      • Deleting billions of files from a directory while seeing the progress as well





                      share|improve this answer
























                        up vote
                        0
                        down vote













                        The difference in performance that you are seeing is likely because your /tmp directory is mounted in RAM as opposed to physical storage. You can check this with mount.



                        Also different types of file systems have different performance impacts in certain operations. XFS should outperform ext4, as should btrfs.



                        These links could be useful too:



                        • Efficiently delete large directory containing thousands of files

                        • Deleting billions of files from a directory while seeing the progress as well





                        share|improve this answer






















                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          The difference in performance that you are seeing is likely because your /tmp directory is mounted in RAM as opposed to physical storage. You can check this with mount.



                          Also different types of file systems have different performance impacts in certain operations. XFS should outperform ext4, as should btrfs.



                          These links could be useful too:



                          • Efficiently delete large directory containing thousands of files

                          • Deleting billions of files from a directory while seeing the progress as well





                          share|improve this answer












                          The difference in performance that you are seeing is likely because your /tmp directory is mounted in RAM as opposed to physical storage. You can check this with mount.



                          Also different types of file systems have different performance impacts in certain operations. XFS should outperform ext4, as should btrfs.



                          These links could be useful too:



                          • Efficiently delete large directory containing thousands of files

                          • Deleting billions of files from a directory while seeing the progress as well






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Feb 19 at 14:02









                          Pedro

                          59429




                          59429






















                               

                              draft saved


                              draft discarded


























                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f424451%2fis-there-any-way-to-make-a-folder-behave-the-same-as-tmp%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Popular posts from this blog

                              How to check contact read email or not when send email to Individual?

                              Displaying single band from multi-band raster using QGIS

                              How many registers does an x86_64 CPU actually have?