How to Resize a Live Filesystem on Linux

Поделиться
HTML-код
  • Опубликовано: 13 янв 2019
  • Before anything else, BACKUP your stuff! This method is risky, and only works on ext2/3/4 filesystems
    Use fdisk /dev/sda to check current start/end sectors
    Use fdisk to delete the partition
    Use fdisk to create a new partition with same starting sector, but new end sector.
    Verify that your changes are what you want.
    Write fdisk changes.
    Verify the new partition is the expected size.
    Use sudo resize2fs /dev/sda1 to resize the filesystem to utilize all space in the new partition.
    Verify the partition is the expected size.
    Reboot for safety.

Комментарии • 114

  • @user-yt2cv9ke1y
    @user-yt2cv9ke1y 3 года назад +4

    This is a really good tutorial. The author is really cautious. Everything works fine for me, thank you.

  • @sh1dori366
    @sh1dori366 2 года назад +3

    Damn, only person after almost 3 hours who finally helped me. Good Job!

  • @GerardoSangronis
    @GerardoSangronis 4 года назад +3

    A very useful tutorial... that was exactly what I was looking for. .. thank you so much for sharing...

  • @yermidavid3389
    @yermidavid3389 3 года назад +2

    A clear and relevant explanation
    A very professional guide

  • @RajeshMaharjan431
    @RajeshMaharjan431 4 года назад +2

    This really helped me to solve my resize problem in ubuntu server 18.04 LTS.

  • @maxiljin1034
    @maxiljin1034 3 года назад +1

    Amazing manual! Thx so much! For linux noobs it is just amazing! Lost my time looking for crazy scripts from guru people until found yours!

  • @DonProshetsky
    @DonProshetsky 4 года назад +2

    Good video but after I modify my volume by adding 35GB, performing the commands as per this video doesn't allow me to extend my logical partition (value out of range)

  • @Frank-do1bg
    @Frank-do1bg 7 месяцев назад

    This helped me out a lot! Very easy to understand.

  • @BMS342
    @BMS342 3 года назад

    Is there any way to merge an unallocated space with ext4 partition from Windows or Linux environment?

  • @draxler2941
    @draxler2941 3 года назад +2

    Thanks a lot for making this tutorial dude.... you are a legend

  • @ajmalbinnizam
    @ajmalbinnizam 3 года назад

    i got some major problems and error magic disk failed to partition ..and when i restarted can't login to ubuntu...i use dual boot

  • @jamesamestosopalin9317
    @jamesamestosopalin9317 2 года назад +1

    can you increase the size of partition sda1 without deleting and creating new partition?

  • @M.C.D.Technologies
    @M.C.D.Technologies 4 года назад +2

    Thanks a bunch, I ended up doing a clone of an OMV install from a smaller drive to a larger one and even GParted would not let me extend the volume. This, however, worked a treat, keep up the great work and thank you.

    • @bambamkey1
      @bambamkey1 3 года назад

      Which partition did you extend EFI or Linux filesystem?

  • @john2knj
    @john2knj 3 месяца назад

    Reboot causes me to lose my space gained. In df I go from 73G to 88G after running resize2fs /dev/sda2. After reboot it goes back to 73G. Any idea what might be causing that?

  • @josejaldin5104
    @josejaldin5104 3 года назад

    Thank you for an excellent and very useful tutorial.

  • @abhinaykosuru2420
    @abhinaykosuru2420 4 года назад

    I have partitions other than sda1 so what should i do??

  • @AcadaKedrava
    @AcadaKedrava 2 года назад

    I found some problem Sir. Can u help me?plz
    After doing this
    ERROR: attempt to read or write outside of partition

  • @boxerfencer
    @boxerfencer 2 года назад

    You did this from a live system? What about if all my space is allocated already, have room in /home some of which i could spare, but have a root partition which is almost at capacity. I'd need to shrink /home, before adding to root, and finalize with the past command only once.
    I'd like to increase my swap too, while I'm at it.
    I'm, does gparted work live now, or do we still have to boot up from a live CD?

  • @techenthusiast2590
    @techenthusiast2590 2 года назад

    Can we shrink the size of sda1 using this, if yes then what should be sector value?

  • @joeprinz4351
    @joeprinz4351 Год назад +2

    This really helped me out. Resized vm drive on open media vault. Worked perfectly. Only slight confusing part was partition number. I guess if it is sdb1 its 1 if it is sdb2 its 2... anyway I chose 1 for sdb1 and it worked perfectly. I took a backup before (524g of video). be sure and backup this is risky.

  • @TON-vz3pe
    @TON-vz3pe 3 года назад +4

    You seriously don't know the pain I went through in searching for a perfect videos which shows a live partition using a terminal.
    You brother made my day. Thanks a lot. Bless you 😇.

    • @endersftd
      @endersftd  3 года назад

      Wow! I'm really glad this helped you!

    • @OGOXY
      @OGOXY 3 года назад

      @@endersftd im terrified to do this i dont have anything to backup/boot new arch install off of. but i cant create my bare metal windows vms without it completely filling my 50GB filesystem partition which i thought would be more than enough it has 31GB left with 3 kernels linux linux-lts and linux-zen on it but as soon as i install a windows vm it max's my root filesystem partition all the way and then the vm wont run :( is there a safe way i could achieve this? like could i install the windows vm and get to desktop on it then shut it down and somehow move the windows 10 OS to my home/usr storage partition that has 1.7TB left on it?

  • @pavanrocks29
    @pavanrocks29 4 года назад

    Thanks for uploading this, really helpful.

  • @longsyee
    @longsyee 3 года назад

    how to do one disk with 2 partition one for linux os one for data storing (only extend the data storing

  • @prapulkrishna
    @prapulkrishna 6 месяцев назад

    This is very well explained thanks for the video.

  • @stansmiley9271
    @stansmiley9271 4 года назад

    Worked perfectly. Thanks!

  • @thefastreviewer
    @thefastreviewer Год назад +1

    You truly are a lifesaver! Thanks a lot for such an informative video!

    • @endersftd
      @endersftd  Год назад

      I appreciate the kind words. Makes my day :)

  • @aleem-eh2me
    @aleem-eh2me 3 года назад

    man really awesome ,expecting more videos

  • @romeodmello153
    @romeodmello153 4 года назад

    Thanks , this video was useful , keep it up

  • @estebankelevra9720
    @estebankelevra9720 3 года назад +1

    Dude, you're a legend

  • @jonsnow9758
    @jonsnow9758 2 года назад

    Great video but for last command I'm getting this error...
    # resize2fs /dev/nvme0n1
    resize2fs: Device or resource busy while trying to open /dev/nvme0n1
    Couldn't find valid filesystem superblock.
    filesystem look like this:
    Device Boot Start End Sectors Size Id Type
    /dev/nvme0n1p1 * 2048 2099199 2097152 1G 83 Linux
    /dev/nvme0n1p2 2099200 41943039 39843840 19G 8e Linux LVM

  • @Duesi2024
    @Duesi2024 Год назад

    Thank you very much. Stuggled an hour before i got to oyur video. Did it with your video within 5 minutes, skipping your video 👍

    • @endersftd
      @endersftd  Год назад

      I'm pleased to hear this! I needed some good news today!

  • @nicolaytangarife4799
    @nicolaytangarife4799 3 года назад

    Man thanks for this video. has saved me

  • @uttamkumarkumar3171
    @uttamkumarkumar3171 Год назад

    Well demonstrated session

  • @robinsongrullon6048
    @robinsongrullon6048 4 года назад

    Marvelous explained!!!

  • @MikePoirier
    @MikePoirier 4 года назад

    Very useful, thank you.

  • @Ukepa
    @Ukepa Год назад

    very useful, and what I was looking for....

  • @rikrjh
    @rikrjh 3 года назад +1

    thx!! you saved my life!!!

  • @balasahebkatare1053
    @balasahebkatare1053 2 года назад

    Very useful tutorial....

  • @Nabilphysics
    @Nabilphysics Год назад

    omg. This men should be awarded a noble prize for Linux File System Partition

  • @mijoo94
    @mijoo94 2 года назад

    Thnx man you saved my day

  • @foxyt4066
    @foxyt4066 4 года назад

    unfortunatly not working to increase a virtual machines disc space.

  • @Aizen1
    @Aizen1 3 года назад

    Nice video ❤️
    U rly help me

  • @benjamindreyer9884
    @benjamindreyer9884 2 года назад +3

    This works great but what if the unallocated space and the partition you are trying to resize have partitions in between them? this way you will overwrite the other partitions because you can't make it bigger

    • @endersftd
      @endersftd  2 года назад +1

      That's a very good point.

    • @benjamindreyer9884
      @benjamindreyer9884 2 года назад

      @@endersftd idk i just decided to remove windows for good, i wasn't even using it tbh, now im not going back lol

    • @TON-vz3pe
      @TON-vz3pe 2 года назад +1

      Then you move all your files from those other partitions first to the primary partition. Then delete those partitions. Then do this process in the video.

    • @Ana-vd1rl
      @Ana-vd1rl Год назад

      How to learn it from scratch?

  • @anidea8012
    @anidea8012 4 года назад

    Thank god for suggesting you to me

  • @ananshagrawal8131
    @ananshagrawal8131 3 года назад

    I'm getting a problem which says "the superblock could not be read or it is not able to describe the file extension". please help me out with the same

    • @endersftd
      @endersftd  3 года назад +1

      Hard to say for sure. What filesystem are you using?

    • @ananshagrawal8131
      @ananshagrawal8131 3 года назад

      @@endersftd vdi i guess

  • @kshitizsinghinformationsci6032

    This work for expanding and creating the new drive when we expand without unmounting. Will this work for shrinking the drive size without unmounting?

    • @kshitizsinghinformationsci6032
      @kshitizsinghinformationsci6032 Год назад

      Is there no need to use option 8e for LVM?

    • @endersftd
      @endersftd  Год назад

      I would not recommend it. You have to ensure you don't truncate data in your filesystem when you resize the partition. I don't know how to move data like gparted does.

  • @ZubairAhmed1024
    @ZubairAhmed1024 3 года назад

    You're a legend 🙏

  • @anandmano4375
    @anandmano4375 2 года назад

    Absolutely Great... Thank you so much .. You are so cool ..clear... nice...

  • @leandrotoledo8114
    @leandrotoledo8114 3 года назад

    tks. Amazing Tutorial

  • @aer0449
    @aer0449 3 года назад

    OMG thank you .... I subbed you brother .....

  • @asghvasaskhdn2477
    @asghvasaskhdn2477 2 года назад

    thank you so much man

  • @vishal8274
    @vishal8274 3 года назад

    Thank u so much sir❤

  • @saidzeyrek4824
    @saidzeyrek4824 3 года назад

    İt messed up my pc now I can't boot neither windows nor linux

  • @sumanpanchal6938
    @sumanpanchal6938 6 месяцев назад

    What if rootfs (/) is on "mmcblk0" !
    I mean it's eMMC instead MMC / SD / hard-drive!
    I am unable to resize live rootfs !

    • @endersftd
      @endersftd  6 месяцев назад

      Everything else being equal, I don't see why mmc storage would be any different. You just refer to it by /dev/mmc.... Rather than /dev/sda

    • @sumanpanchal6938
      @sumanpanchal6938 6 месяцев назад

      @@endersftd okay!

  • @salexkorsan8790
    @salexkorsan8790 3 года назад

    i'm attached New HDD Direct to Motherboard,
    how to rescan internal Hardware / i want to Use HDD without Reboot ??? in Linux
    i'm tried lot of commands
    finding this solution from two weeks
    please help

    • @endersftd
      @endersftd  3 года назад +1

      Does your motherboard support hotswapping in a new hard drive without rebooting?

    • @salexkorsan8790
      @salexkorsan8790 3 года назад

      @@endersftd Yes /
      and 4 years ago i found a command to detect New attached HDD direct in motherboard, in kali linux, But i lost that command. already i'm used it

    • @endersftd
      @endersftd  3 года назад

      ​@@salexkorsan8790 SATA disk?

    • @salexkorsan8790
      @salexkorsan8790 3 года назад

      @@endersftd Yes Brother

    • @endersftd
      @endersftd  3 года назад

      ​@@salexkorsan8790 if you do a lsblk command, it doesn't show up, correct?

  • @DanielDuhon
    @DanielDuhon 2 года назад

    So what about reducing the size of the root partition?

    • @endersftd
      @endersftd  2 года назад

      Definitely not possible this way. Only way I've ever done it is offline using something like gparted. I know there's supposed to be ways to defrag ext4, but I don't think it would be a safe way to group everything together before slicing off a piece of the partition.

  • @hamzalaanbare7302
    @hamzalaanbare7302 Год назад

    Thank you so much

  • @marcospatzer7471
    @marcospatzer7471 3 года назад

    Excelent, thank you

  • @tejasmd8143
    @tejasmd8143 11 месяцев назад +1

    It is 2am on a random night after a super shitty day and I can't believe resizing my filesystem live would bring back my spark. Thanks man : )

  • @WendellMcAdoo
    @WendellMcAdoo 4 года назад

    Dude you are awesome

    • @endersftd
      @endersftd  4 года назад

      I appreciate it :) Makes my day

  • @michaelinzo
    @michaelinzo 3 года назад

    Value out of range for me i'm tryna extend 32gb into 100 gb ( 67108863 sectors max but Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors )

    • @michaelinzo
      @michaelinzo 3 года назад

      *fixed it I forgot to reboot because I created extra partition sda3, which has physical live, add volume group etc.*

  • @johndicarlo225
    @johndicarlo225 Год назад

    thanks dude

  • @LFCJasiek
    @LFCJasiek 2 года назад

    Well, I am not as happy as the other guys. I did as instructed to remove a logical partition and create two separate partitions in its place. I used default, +5G; default, default. Then I ran the additional command "sudo resize2fs dev/sda5" and it read that there was nothing to change. I rebooted the machine as the changes were not reflecting after typing in lsblk and... I cannot boot... I reads error: unknown filesystem. Entering rescue mode... grub rescue>. Damn... I have not lost anything as I did it on a VM but still sucks since I have to reinstall the bloody thing I guess.

    • @endersftd
      @endersftd  2 года назад

      Were you using LVM? If so, these instructions won't do what you want.

    • @LFCJasiek
      @LFCJasiek 2 года назад

      @@endersftd Yeah man, is it only applicable for those who have it installed on their actual machines? If so is there a resource, or maybe a video of yours, you could recommend? I am running Ubuntu on Oracle VM VirtualBox

  • @stalinengoma7680
    @stalinengoma7680 3 года назад

    NIce one buddy

  • @hyungjoonpark83
    @hyungjoonpark83 3 года назад

    does it work on ssd?

  • @naoremsana5664
    @naoremsana5664 4 года назад

    Thanks alot

  • @callumoliver4063
    @callumoliver4063 3 года назад

    Legend

  • @krutakpatel8540
    @krutakpatel8540 4 года назад

    Am Wondering.. Are you Professor in money heist...netflix...??...B/s your voice is same like Professor in money heist...netflix.

  • @Ana-vd1rl
    @Ana-vd1rl Год назад

    How to red hat linux from scratch?

  • @llamingo
    @llamingo 4 года назад

    you peak exactly as Linus Torvalds

  • @jaimeandresvegaquiroz4944
    @jaimeandresvegaquiroz4944 2 года назад

    thanks

  • @le.hazmel
    @le.hazmel 3 года назад +1

    Is this a linux ASMR?

    • @endersftd
      @endersftd  3 года назад +2

      I'll admit, it wasnt entirely unintentional. But I also did it in the office, so I needed to be quiet

    • @le.hazmel
      @le.hazmel 3 года назад

      @@endersftd I was just joking great video btw

  • @SHahabhashemi
    @SHahabhashemi Год назад

    Thank You for the tutorial but it's cold be 10 time faster.
    it's solve my problem.

    • @endersftd
      @endersftd  Год назад

      You're right. That's why all the commands are in the description

  • @rsmaster5637
    @rsmaster5637 3 года назад

    Tried and destroyed my sd … oops 😅

  • @GabrielBallardin
    @GabrielBallardin 2 месяца назад

    ok ok, but how to do this without messing everything up hahaha

    • @endersftd
      @endersftd  2 месяца назад

      Haha, the *best* way is to do it offline instead of a live system, but even then you can mess something up. 😅 What issue did you run into?

  • @therealvbw
    @therealvbw 4 года назад +2

    Noobs' way of doing this more easily and maybe more safely: GParted!
    Get it from apt, or *cough* software centre *cough*, and it's a GUI (window) interface to resize partitions and many more things :)

    • @endersftd
      @endersftd  4 года назад +3

      Would only work if you're on a GUI environment (or booted from a LiveCD). If you *can* do this, it's preferable. But if you're on a server that is command line only, this isn't an option.

  • @michaelinzo
    @michaelinzo 3 года назад

    This shit format your disk

  • @MR-vj8dn
    @MR-vj8dn Год назад

    Awful method 😂 Deleting your partition to expand it. What!?

    • @endersftd
      @endersftd  Год назад

      Semantics. You can't resize the partition without changing it.

  • @charlesklein7232
    @charlesklein7232 Год назад

    if you only increased it by 5 gig would you still use the "sudo resize2fs /dev/sda1" it seems this is ONLY! for using all space.

    • @endersftd
      @endersftd  Год назад

      I believe as long as your resized partition is set properly to include just the 5gb you need, the resize command will fill the space in the partition.

  • @rohitbuchake
    @rohitbuchake 2 года назад +3

    This is a really good tutorial. The author is really cautious. Everything works fine for me, thank you.

  • @fahadalmulhim461
    @fahadalmulhim461 3 года назад

    thanks