Why do an XFS volume need to be mounted in order to resize?












0















If I have an ext4 volume I can resize it regardless of it being mounted or not using the resize2fs command (supplying the device), but for an XFS formatted partition I would need to mount the volume in order to do that (using xfs_growfs). Is there a reason for this?



By the way if I want to resize an XFS volume, could I just mount it on a temporary directory and run xfs_growfs and then unmount it again? Regardless of it being mounted elsewhere? Or would xfs_growfs be dangerous if the same volume is mounted at multiple mount points?










share|improve this question



























    0















    If I have an ext4 volume I can resize it regardless of it being mounted or not using the resize2fs command (supplying the device), but for an XFS formatted partition I would need to mount the volume in order to do that (using xfs_growfs). Is there a reason for this?



    By the way if I want to resize an XFS volume, could I just mount it on a temporary directory and run xfs_growfs and then unmount it again? Regardless of it being mounted elsewhere? Or would xfs_growfs be dangerous if the same volume is mounted at multiple mount points?










    share|improve this question

























      0












      0








      0








      If I have an ext4 volume I can resize it regardless of it being mounted or not using the resize2fs command (supplying the device), but for an XFS formatted partition I would need to mount the volume in order to do that (using xfs_growfs). Is there a reason for this?



      By the way if I want to resize an XFS volume, could I just mount it on a temporary directory and run xfs_growfs and then unmount it again? Regardless of it being mounted elsewhere? Or would xfs_growfs be dangerous if the same volume is mounted at multiple mount points?










      share|improve this question














      If I have an ext4 volume I can resize it regardless of it being mounted or not using the resize2fs command (supplying the device), but for an XFS formatted partition I would need to mount the volume in order to do that (using xfs_growfs). Is there a reason for this?



      By the way if I want to resize an XFS volume, could I just mount it on a temporary directory and run xfs_growfs and then unmount it again? Regardless of it being mounted elsewhere? Or would xfs_growfs be dangerous if the same volume is mounted at multiple mount points?







      mount xfs lvm2






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 20 '18 at 18:09









      skykingskyking

      1164




      1164






















          1 Answer
          1






          active

          oldest

          votes


















          0















          If I have an ext4 volume I can resize it regardless of it being mounted or not using the resize2fs command (supplying the device), but for an XFS formatted partition I would need to mount the volume in order to do that (using xfs_growfs). Is there a reason for this?




          For the same reason that there's no tool to shrink an XFS volume, the developers didn't see it as important and therefore never implemented it. I can actually kind of understand the reasoning for this too. There are essentially no cases where you will need to resize a volume and can't also mount it, and handling the resize in the kernel code means you don't have to worry about whether the volume is clean or not.



          It's probably worth noting that xFS is not unique in this respect, BTRFS also requires a volume to be mounted before it can be resized, and some other filesystems are like this too. Others are only resizable if unmounted. The ext2/3/4 formats are actually kind of the odd ones out here in that they can be resized both when mounted and when unmounted.






          By the way if I want to resize an XFS volume, could I just mount it on a temporary directory and run xfs_growfs and then unmount it again? Regardless of it being mounted elsewhere? Or would xfs_growfs be dangerous if the same volume is mounted at multiple mount points?




          This is a bit more complicated to answer. All recent Linux kernels sanely handle multiple mounts of the same volume (internally, there's one mount which all the userspace visible instances reference), and on such kernels, it's perfectly safe to mount an XFS volume a second time somewhere and run xfs_growfs on it, though it doesn't really give you any benefits over just calling xfs_growfs on the original mountpoint by doing this. If you're using an older kernel though, or are dealing with shared storage where a different node, you should avoid mounting the volume again regardless of what you are planning to do with the extra mount, as you may destroy it in the process.






          share|improve this answer


























          • The last sentence seem to be missing something. Could you fix that?

            – skyking
            Dec 21 '18 at 7:28











          • Regarding your last sentence. Does it imply that mounting a volume again is inherently dangerous? Or is it just in conjunction with xfs_growfs the danger arises?

            – skyking
            Dec 21 '18 at 7:29











          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%2f1386386%2fwhy-do-an-xfs-volume-need-to-be-mounted-in-order-to-resize%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















          If I have an ext4 volume I can resize it regardless of it being mounted or not using the resize2fs command (supplying the device), but for an XFS formatted partition I would need to mount the volume in order to do that (using xfs_growfs). Is there a reason for this?




          For the same reason that there's no tool to shrink an XFS volume, the developers didn't see it as important and therefore never implemented it. I can actually kind of understand the reasoning for this too. There are essentially no cases where you will need to resize a volume and can't also mount it, and handling the resize in the kernel code means you don't have to worry about whether the volume is clean or not.



          It's probably worth noting that xFS is not unique in this respect, BTRFS also requires a volume to be mounted before it can be resized, and some other filesystems are like this too. Others are only resizable if unmounted. The ext2/3/4 formats are actually kind of the odd ones out here in that they can be resized both when mounted and when unmounted.






          By the way if I want to resize an XFS volume, could I just mount it on a temporary directory and run xfs_growfs and then unmount it again? Regardless of it being mounted elsewhere? Or would xfs_growfs be dangerous if the same volume is mounted at multiple mount points?




          This is a bit more complicated to answer. All recent Linux kernels sanely handle multiple mounts of the same volume (internally, there's one mount which all the userspace visible instances reference), and on such kernels, it's perfectly safe to mount an XFS volume a second time somewhere and run xfs_growfs on it, though it doesn't really give you any benefits over just calling xfs_growfs on the original mountpoint by doing this. If you're using an older kernel though, or are dealing with shared storage where a different node, you should avoid mounting the volume again regardless of what you are planning to do with the extra mount, as you may destroy it in the process.






          share|improve this answer


























          • The last sentence seem to be missing something. Could you fix that?

            – skyking
            Dec 21 '18 at 7:28











          • Regarding your last sentence. Does it imply that mounting a volume again is inherently dangerous? Or is it just in conjunction with xfs_growfs the danger arises?

            – skyking
            Dec 21 '18 at 7:29
















          0















          If I have an ext4 volume I can resize it regardless of it being mounted or not using the resize2fs command (supplying the device), but for an XFS formatted partition I would need to mount the volume in order to do that (using xfs_growfs). Is there a reason for this?




          For the same reason that there's no tool to shrink an XFS volume, the developers didn't see it as important and therefore never implemented it. I can actually kind of understand the reasoning for this too. There are essentially no cases where you will need to resize a volume and can't also mount it, and handling the resize in the kernel code means you don't have to worry about whether the volume is clean or not.



          It's probably worth noting that xFS is not unique in this respect, BTRFS also requires a volume to be mounted before it can be resized, and some other filesystems are like this too. Others are only resizable if unmounted. The ext2/3/4 formats are actually kind of the odd ones out here in that they can be resized both when mounted and when unmounted.






          By the way if I want to resize an XFS volume, could I just mount it on a temporary directory and run xfs_growfs and then unmount it again? Regardless of it being mounted elsewhere? Or would xfs_growfs be dangerous if the same volume is mounted at multiple mount points?




          This is a bit more complicated to answer. All recent Linux kernels sanely handle multiple mounts of the same volume (internally, there's one mount which all the userspace visible instances reference), and on such kernels, it's perfectly safe to mount an XFS volume a second time somewhere and run xfs_growfs on it, though it doesn't really give you any benefits over just calling xfs_growfs on the original mountpoint by doing this. If you're using an older kernel though, or are dealing with shared storage where a different node, you should avoid mounting the volume again regardless of what you are planning to do with the extra mount, as you may destroy it in the process.






          share|improve this answer


























          • The last sentence seem to be missing something. Could you fix that?

            – skyking
            Dec 21 '18 at 7:28











          • Regarding your last sentence. Does it imply that mounting a volume again is inherently dangerous? Or is it just in conjunction with xfs_growfs the danger arises?

            – skyking
            Dec 21 '18 at 7:29














          0












          0








          0








          If I have an ext4 volume I can resize it regardless of it being mounted or not using the resize2fs command (supplying the device), but for an XFS formatted partition I would need to mount the volume in order to do that (using xfs_growfs). Is there a reason for this?




          For the same reason that there's no tool to shrink an XFS volume, the developers didn't see it as important and therefore never implemented it. I can actually kind of understand the reasoning for this too. There are essentially no cases where you will need to resize a volume and can't also mount it, and handling the resize in the kernel code means you don't have to worry about whether the volume is clean or not.



          It's probably worth noting that xFS is not unique in this respect, BTRFS also requires a volume to be mounted before it can be resized, and some other filesystems are like this too. Others are only resizable if unmounted. The ext2/3/4 formats are actually kind of the odd ones out here in that they can be resized both when mounted and when unmounted.






          By the way if I want to resize an XFS volume, could I just mount it on a temporary directory and run xfs_growfs and then unmount it again? Regardless of it being mounted elsewhere? Or would xfs_growfs be dangerous if the same volume is mounted at multiple mount points?




          This is a bit more complicated to answer. All recent Linux kernels sanely handle multiple mounts of the same volume (internally, there's one mount which all the userspace visible instances reference), and on such kernels, it's perfectly safe to mount an XFS volume a second time somewhere and run xfs_growfs on it, though it doesn't really give you any benefits over just calling xfs_growfs on the original mountpoint by doing this. If you're using an older kernel though, or are dealing with shared storage where a different node, you should avoid mounting the volume again regardless of what you are planning to do with the extra mount, as you may destroy it in the process.






          share|improve this answer
















          If I have an ext4 volume I can resize it regardless of it being mounted or not using the resize2fs command (supplying the device), but for an XFS formatted partition I would need to mount the volume in order to do that (using xfs_growfs). Is there a reason for this?




          For the same reason that there's no tool to shrink an XFS volume, the developers didn't see it as important and therefore never implemented it. I can actually kind of understand the reasoning for this too. There are essentially no cases where you will need to resize a volume and can't also mount it, and handling the resize in the kernel code means you don't have to worry about whether the volume is clean or not.



          It's probably worth noting that xFS is not unique in this respect, BTRFS also requires a volume to be mounted before it can be resized, and some other filesystems are like this too. Others are only resizable if unmounted. The ext2/3/4 formats are actually kind of the odd ones out here in that they can be resized both when mounted and when unmounted.






          By the way if I want to resize an XFS volume, could I just mount it on a temporary directory and run xfs_growfs and then unmount it again? Regardless of it being mounted elsewhere? Or would xfs_growfs be dangerous if the same volume is mounted at multiple mount points?




          This is a bit more complicated to answer. All recent Linux kernels sanely handle multiple mounts of the same volume (internally, there's one mount which all the userspace visible instances reference), and on such kernels, it's perfectly safe to mount an XFS volume a second time somewhere and run xfs_growfs on it, though it doesn't really give you any benefits over just calling xfs_growfs on the original mountpoint by doing this. If you're using an older kernel though, or are dealing with shared storage where a different node, you should avoid mounting the volume again regardless of what you are planning to do with the extra mount, as you may destroy it in the process.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 21 '18 at 18:53

























          answered Dec 20 '18 at 19:46









          Austin HemmelgarnAustin Hemmelgarn

          2,61419




          2,61419













          • The last sentence seem to be missing something. Could you fix that?

            – skyking
            Dec 21 '18 at 7:28











          • Regarding your last sentence. Does it imply that mounting a volume again is inherently dangerous? Or is it just in conjunction with xfs_growfs the danger arises?

            – skyking
            Dec 21 '18 at 7:29



















          • The last sentence seem to be missing something. Could you fix that?

            – skyking
            Dec 21 '18 at 7:28











          • Regarding your last sentence. Does it imply that mounting a volume again is inherently dangerous? Or is it just in conjunction with xfs_growfs the danger arises?

            – skyking
            Dec 21 '18 at 7:29

















          The last sentence seem to be missing something. Could you fix that?

          – skyking
          Dec 21 '18 at 7:28





          The last sentence seem to be missing something. Could you fix that?

          – skyking
          Dec 21 '18 at 7:28













          Regarding your last sentence. Does it imply that mounting a volume again is inherently dangerous? Or is it just in conjunction with xfs_growfs the danger arises?

          – skyking
          Dec 21 '18 at 7:29





          Regarding your last sentence. Does it imply that mounting a volume again is inherently dangerous? Or is it just in conjunction with xfs_growfs the danger arises?

          – skyking
          Dec 21 '18 at 7:29


















          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%2f1386386%2fwhy-do-an-xfs-volume-need-to-be-mounted-in-order-to-resize%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

          Сан-Квентин

          Алькесар

          Josef Freinademetz