How to extend size of mounted ext4 /home gpt partition without loss of data?

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











up vote
-1
down vote

favorite












I have GPT partitioning for my drive:



$ sudo fdisk -l /dev/sda
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 8E38B9BD-5EA6-40F6-9C2B-98E5F801B29D

Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 59643903 58593280 28G Linux filesystem
/dev/sda3 59643904 90894335 31250432 14.9G Linux swap
/dev/sda4 90894336 588941311 498046976 237.5G Linux filesystem
/dev/sda5 588941312 976771071 387829760 185G Linux filesystem

$ mount | grep /dev/sda
/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
/dev/sda4 on /home type ext4 (rw,relatime,data=ordered)

$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 512M 0 part
├─sda2 8:2 0 28G 0 part /
├─sda3 8:3 0 14.9G 0 part [SWAP]
├─sda4 8:4 0 237.5G 0 part /home
└─sda5 8:5 0 185G 0 part
sr0 11:0 1 1024M 0 rom


The sda5 partition was meant to be /media/DATA partition, but I changed my mind, and I am using the /home to store my data. But, the /home is almost full, now.



How can I grow (+100GB) mounted /home partition without loss of data?







share|improve this question























    up vote
    -1
    down vote

    favorite












    I have GPT partitioning for my drive:



    $ sudo fdisk -l /dev/sda
    Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: 8E38B9BD-5EA6-40F6-9C2B-98E5F801B29D

    Device Start End Sectors Size Type
    /dev/sda1 2048 1050623 1048576 512M EFI System
    /dev/sda2 1050624 59643903 58593280 28G Linux filesystem
    /dev/sda3 59643904 90894335 31250432 14.9G Linux swap
    /dev/sda4 90894336 588941311 498046976 237.5G Linux filesystem
    /dev/sda5 588941312 976771071 387829760 185G Linux filesystem

    $ mount | grep /dev/sda
    /dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
    /dev/sda4 on /home type ext4 (rw,relatime,data=ordered)

    $ lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda 8:0 0 465.8G 0 disk
    ├─sda1 8:1 0 512M 0 part
    ├─sda2 8:2 0 28G 0 part /
    ├─sda3 8:3 0 14.9G 0 part [SWAP]
    ├─sda4 8:4 0 237.5G 0 part /home
    └─sda5 8:5 0 185G 0 part
    sr0 11:0 1 1024M 0 rom


    The sda5 partition was meant to be /media/DATA partition, but I changed my mind, and I am using the /home to store my data. But, the /home is almost full, now.



    How can I grow (+100GB) mounted /home partition without loss of data?







    share|improve this question





















      up vote
      -1
      down vote

      favorite









      up vote
      -1
      down vote

      favorite











      I have GPT partitioning for my drive:



      $ sudo fdisk -l /dev/sda
      Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
      Units: sectors of 1 * 512 = 512 bytes
      Sector size (logical/physical): 512 bytes / 512 bytes
      I/O size (minimum/optimal): 512 bytes / 512 bytes
      Disklabel type: gpt
      Disk identifier: 8E38B9BD-5EA6-40F6-9C2B-98E5F801B29D

      Device Start End Sectors Size Type
      /dev/sda1 2048 1050623 1048576 512M EFI System
      /dev/sda2 1050624 59643903 58593280 28G Linux filesystem
      /dev/sda3 59643904 90894335 31250432 14.9G Linux swap
      /dev/sda4 90894336 588941311 498046976 237.5G Linux filesystem
      /dev/sda5 588941312 976771071 387829760 185G Linux filesystem

      $ mount | grep /dev/sda
      /dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
      /dev/sda4 on /home type ext4 (rw,relatime,data=ordered)

      $ lsblk
      NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
      sda 8:0 0 465.8G 0 disk
      ├─sda1 8:1 0 512M 0 part
      ├─sda2 8:2 0 28G 0 part /
      ├─sda3 8:3 0 14.9G 0 part [SWAP]
      ├─sda4 8:4 0 237.5G 0 part /home
      └─sda5 8:5 0 185G 0 part
      sr0 11:0 1 1024M 0 rom


      The sda5 partition was meant to be /media/DATA partition, but I changed my mind, and I am using the /home to store my data. But, the /home is almost full, now.



      How can I grow (+100GB) mounted /home partition without loss of data?







      share|improve this question











      I have GPT partitioning for my drive:



      $ sudo fdisk -l /dev/sda
      Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
      Units: sectors of 1 * 512 = 512 bytes
      Sector size (logical/physical): 512 bytes / 512 bytes
      I/O size (minimum/optimal): 512 bytes / 512 bytes
      Disklabel type: gpt
      Disk identifier: 8E38B9BD-5EA6-40F6-9C2B-98E5F801B29D

      Device Start End Sectors Size Type
      /dev/sda1 2048 1050623 1048576 512M EFI System
      /dev/sda2 1050624 59643903 58593280 28G Linux filesystem
      /dev/sda3 59643904 90894335 31250432 14.9G Linux swap
      /dev/sda4 90894336 588941311 498046976 237.5G Linux filesystem
      /dev/sda5 588941312 976771071 387829760 185G Linux filesystem

      $ mount | grep /dev/sda
      /dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
      /dev/sda4 on /home type ext4 (rw,relatime,data=ordered)

      $ lsblk
      NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
      sda 8:0 0 465.8G 0 disk
      ├─sda1 8:1 0 512M 0 part
      ├─sda2 8:2 0 28G 0 part /
      ├─sda3 8:3 0 14.9G 0 part [SWAP]
      ├─sda4 8:4 0 237.5G 0 part /home
      └─sda5 8:5 0 185G 0 part
      sr0 11:0 1 1024M 0 rom


      The sda5 partition was meant to be /media/DATA partition, but I changed my mind, and I am using the /home to store my data. But, the /home is almost full, now.



      How can I grow (+100GB) mounted /home partition without loss of data?









      share|improve this question










      share|improve this question




      share|improve this question









      asked May 27 at 10:46









      kravemir

      1,41621937




      1,41621937




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          I haven't used fdisk in a long time. I use gdisk, and with gdisk you can delete /dev/sda5, and then delete /dev/sda4, and then create sda4 again with same beginning offset (be careful) as before, but with size set to what you want it to be. Once that's done, save, and exit. You may be required to run partprobe (from parted) to refresh the /proc/partitions. Once /proc/partitions is refreshed with updated size of /dev/sda4, and /dev/sda5 gone, then run resize2fs /dev/sda4 to resize it. Also in fdisk before making any changes, make sure to set display units to sectors (using u command).






          share|improve this answer





















          • Do you know whether size changes (or partprobe updates in general) affect mounted partitions?
            – Hauke Laging
            May 27 at 11:50






          • 1




            the best to affect in-use partitions is to run partx: after having done the gdisk voodoo, partx -u /dev/sda4 would update it (perhaps partx -d /dev/sda5 would be needed no idea)., it can be checked by looking at the content of /sys/class/block/sda4/size before and after partx
            – A.B
            May 27 at 12:15










          • @HaukeLaging --- IIRC, devices in use/mounted will not see these changes.
            – Ashish
            May 28 at 12:59










          • But then your proposal is not going to work, is it?
            – Hauke Laging
            May 28 at 17:20










          • @HaukeLaging, I think with partx -d ..., and partx -u ... mentioned by @A.B, instead of partprobe the instructions will work
            – Ashish
            May 29 at 17:35











          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%2f446299%2fhow-to-extend-size-of-mounted-ext4-home-gpt-partition-without-loss-of-data%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote













          I haven't used fdisk in a long time. I use gdisk, and with gdisk you can delete /dev/sda5, and then delete /dev/sda4, and then create sda4 again with same beginning offset (be careful) as before, but with size set to what you want it to be. Once that's done, save, and exit. You may be required to run partprobe (from parted) to refresh the /proc/partitions. Once /proc/partitions is refreshed with updated size of /dev/sda4, and /dev/sda5 gone, then run resize2fs /dev/sda4 to resize it. Also in fdisk before making any changes, make sure to set display units to sectors (using u command).






          share|improve this answer





















          • Do you know whether size changes (or partprobe updates in general) affect mounted partitions?
            – Hauke Laging
            May 27 at 11:50






          • 1




            the best to affect in-use partitions is to run partx: after having done the gdisk voodoo, partx -u /dev/sda4 would update it (perhaps partx -d /dev/sda5 would be needed no idea)., it can be checked by looking at the content of /sys/class/block/sda4/size before and after partx
            – A.B
            May 27 at 12:15










          • @HaukeLaging --- IIRC, devices in use/mounted will not see these changes.
            – Ashish
            May 28 at 12:59










          • But then your proposal is not going to work, is it?
            – Hauke Laging
            May 28 at 17:20










          • @HaukeLaging, I think with partx -d ..., and partx -u ... mentioned by @A.B, instead of partprobe the instructions will work
            – Ashish
            May 29 at 17:35















          up vote
          1
          down vote













          I haven't used fdisk in a long time. I use gdisk, and with gdisk you can delete /dev/sda5, and then delete /dev/sda4, and then create sda4 again with same beginning offset (be careful) as before, but with size set to what you want it to be. Once that's done, save, and exit. You may be required to run partprobe (from parted) to refresh the /proc/partitions. Once /proc/partitions is refreshed with updated size of /dev/sda4, and /dev/sda5 gone, then run resize2fs /dev/sda4 to resize it. Also in fdisk before making any changes, make sure to set display units to sectors (using u command).






          share|improve this answer





















          • Do you know whether size changes (or partprobe updates in general) affect mounted partitions?
            – Hauke Laging
            May 27 at 11:50






          • 1




            the best to affect in-use partitions is to run partx: after having done the gdisk voodoo, partx -u /dev/sda4 would update it (perhaps partx -d /dev/sda5 would be needed no idea)., it can be checked by looking at the content of /sys/class/block/sda4/size before and after partx
            – A.B
            May 27 at 12:15










          • @HaukeLaging --- IIRC, devices in use/mounted will not see these changes.
            – Ashish
            May 28 at 12:59










          • But then your proposal is not going to work, is it?
            – Hauke Laging
            May 28 at 17:20










          • @HaukeLaging, I think with partx -d ..., and partx -u ... mentioned by @A.B, instead of partprobe the instructions will work
            – Ashish
            May 29 at 17:35













          up vote
          1
          down vote










          up vote
          1
          down vote









          I haven't used fdisk in a long time. I use gdisk, and with gdisk you can delete /dev/sda5, and then delete /dev/sda4, and then create sda4 again with same beginning offset (be careful) as before, but with size set to what you want it to be. Once that's done, save, and exit. You may be required to run partprobe (from parted) to refresh the /proc/partitions. Once /proc/partitions is refreshed with updated size of /dev/sda4, and /dev/sda5 gone, then run resize2fs /dev/sda4 to resize it. Also in fdisk before making any changes, make sure to set display units to sectors (using u command).






          share|improve this answer













          I haven't used fdisk in a long time. I use gdisk, and with gdisk you can delete /dev/sda5, and then delete /dev/sda4, and then create sda4 again with same beginning offset (be careful) as before, but with size set to what you want it to be. Once that's done, save, and exit. You may be required to run partprobe (from parted) to refresh the /proc/partitions. Once /proc/partitions is refreshed with updated size of /dev/sda4, and /dev/sda5 gone, then run resize2fs /dev/sda4 to resize it. Also in fdisk before making any changes, make sure to set display units to sectors (using u command).







          share|improve this answer













          share|improve this answer



          share|improve this answer











          answered May 27 at 11:19









          Ashish

          1462




          1462











          • Do you know whether size changes (or partprobe updates in general) affect mounted partitions?
            – Hauke Laging
            May 27 at 11:50






          • 1




            the best to affect in-use partitions is to run partx: after having done the gdisk voodoo, partx -u /dev/sda4 would update it (perhaps partx -d /dev/sda5 would be needed no idea)., it can be checked by looking at the content of /sys/class/block/sda4/size before and after partx
            – A.B
            May 27 at 12:15










          • @HaukeLaging --- IIRC, devices in use/mounted will not see these changes.
            – Ashish
            May 28 at 12:59










          • But then your proposal is not going to work, is it?
            – Hauke Laging
            May 28 at 17:20










          • @HaukeLaging, I think with partx -d ..., and partx -u ... mentioned by @A.B, instead of partprobe the instructions will work
            – Ashish
            May 29 at 17:35

















          • Do you know whether size changes (or partprobe updates in general) affect mounted partitions?
            – Hauke Laging
            May 27 at 11:50






          • 1




            the best to affect in-use partitions is to run partx: after having done the gdisk voodoo, partx -u /dev/sda4 would update it (perhaps partx -d /dev/sda5 would be needed no idea)., it can be checked by looking at the content of /sys/class/block/sda4/size before and after partx
            – A.B
            May 27 at 12:15










          • @HaukeLaging --- IIRC, devices in use/mounted will not see these changes.
            – Ashish
            May 28 at 12:59










          • But then your proposal is not going to work, is it?
            – Hauke Laging
            May 28 at 17:20










          • @HaukeLaging, I think with partx -d ..., and partx -u ... mentioned by @A.B, instead of partprobe the instructions will work
            – Ashish
            May 29 at 17:35
















          Do you know whether size changes (or partprobe updates in general) affect mounted partitions?
          – Hauke Laging
          May 27 at 11:50




          Do you know whether size changes (or partprobe updates in general) affect mounted partitions?
          – Hauke Laging
          May 27 at 11:50




          1




          1




          the best to affect in-use partitions is to run partx: after having done the gdisk voodoo, partx -u /dev/sda4 would update it (perhaps partx -d /dev/sda5 would be needed no idea)., it can be checked by looking at the content of /sys/class/block/sda4/size before and after partx
          – A.B
          May 27 at 12:15




          the best to affect in-use partitions is to run partx: after having done the gdisk voodoo, partx -u /dev/sda4 would update it (perhaps partx -d /dev/sda5 would be needed no idea)., it can be checked by looking at the content of /sys/class/block/sda4/size before and after partx
          – A.B
          May 27 at 12:15












          @HaukeLaging --- IIRC, devices in use/mounted will not see these changes.
          – Ashish
          May 28 at 12:59




          @HaukeLaging --- IIRC, devices in use/mounted will not see these changes.
          – Ashish
          May 28 at 12:59












          But then your proposal is not going to work, is it?
          – Hauke Laging
          May 28 at 17:20




          But then your proposal is not going to work, is it?
          – Hauke Laging
          May 28 at 17:20












          @HaukeLaging, I think with partx -d ..., and partx -u ... mentioned by @A.B, instead of partprobe the instructions will work
          – Ashish
          May 29 at 17:35





          @HaukeLaging, I think with partx -d ..., and partx -u ... mentioned by @A.B, instead of partprobe the instructions will work
          – Ashish
          May 29 at 17:35













           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f446299%2fhow-to-extend-size-of-mounted-ext4-home-gpt-partition-without-loss-of-data%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?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay