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.
This is a really good tutorial. The author is really cautious. Everything works fine for me, thank you.
Damn, only person after almost 3 hours who finally helped me. Good Job!
A very useful tutorial... that was exactly what I was looking for. .. thank you so much for sharing...
A clear and relevant explanation
A very professional guide
This really helped me to solve my resize problem in ubuntu server 18.04 LTS.
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!
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)
This helped me out a lot! Very easy to understand.
Is there any way to merge an unallocated space with ext4 partition from Windows or Linux environment?
Thanks a lot for making this tutorial dude.... you are a legend
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
can you increase the size of partition sda1 without deleting and creating new partition?
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.
Which partition did you extend EFI or Linux filesystem?
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?
Thank you for an excellent and very useful tutorial.
I have partitions other than sda1 so what should i do??
I found some problem Sir. Can u help me?plz
After doing this
ERROR: attempt to read or write outside of partition
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?
Can we shrink the size of sda1 using this, if yes then what should be sector value?
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.
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 😇.
Wow! I'm really glad this helped you!
@@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?
Thanks for uploading this, really helpful.
how to do one disk with 2 partition one for linux os one for data storing (only extend the data storing
This is very well explained thanks for the video.
Worked perfectly. Thanks!
You truly are a lifesaver! Thanks a lot for such an informative video!
I appreciate the kind words. Makes my day :)
man really awesome ,expecting more videos
Thanks , this video was useful , keep it up
Dude, you're a legend
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
Thank you very much. Stuggled an hour before i got to oyur video. Did it with your video within 5 minutes, skipping your video 👍
I'm pleased to hear this! I needed some good news today!
Man thanks for this video. has saved me
Well demonstrated session
Marvelous explained!!!
Very useful, thank you.
very useful, and what I was looking for....
thx!! you saved my life!!!
Very useful tutorial....
omg. This men should be awarded a noble prize for Linux File System Partition
Thnx man you saved my day
unfortunatly not working to increase a virtual machines disc space.
Nice video ❤️
U rly help me
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
That's a very good point.
@@endersftd idk i just decided to remove windows for good, i wasn't even using it tbh, now im not going back lol
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.
How to learn it from scratch?
Thank god for suggesting you to me
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
Hard to say for sure. What filesystem are you using?
@@endersftd vdi i guess
This work for expanding and creating the new drive when we expand without unmounting. Will this work for shrinking the drive size without unmounting?
Is there no need to use option 8e for LVM?
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.
You're a legend 🙏
Absolutely Great... Thank you so much .. You are so cool ..clear... nice...
tks. Amazing Tutorial
OMG thank you .... I subbed you brother .....
thank you so much man
Thank u so much sir❤
İt messed up my pc now I can't boot neither windows nor linux
What if rootfs (/) is on "mmcblk0" !
I mean it's eMMC instead MMC / SD / hard-drive!
I am unable to resize live rootfs !
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
@@endersftd okay!
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
Does your motherboard support hotswapping in a new hard drive without rebooting?
@@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
@@salexkorsan8790 SATA disk?
@@endersftd Yes Brother
@@salexkorsan8790 if you do a lsblk command, it doesn't show up, correct?
So what about reducing the size of the root partition?
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.
Thank you so much
Excelent, thank you
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 : )
Dude you are awesome
I appreciate it :) Makes my day
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 )
*fixed it I forgot to reboot because I created extra partition sda3, which has physical live, add volume group etc.*
thanks dude
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.
Were you using LVM? If so, these instructions won't do what you want.
@@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
NIce one buddy
does it work on ssd?
I would think so
Thanks alot
Legend
Am Wondering.. Are you Professor in money heist...netflix...??...B/s your voice is same like Professor in money heist...netflix.
How to red hat linux from scratch?
you peak exactly as Linus Torvalds
thanks
Is this a linux ASMR?
I'll admit, it wasnt entirely unintentional. But I also did it in the office, so I needed to be quiet
@@endersftd I was just joking great video btw
Thank You for the tutorial but it's cold be 10 time faster.
it's solve my problem.
You're right. That's why all the commands are in the description
Tried and destroyed my sd … oops 😅
ok ok, but how to do this without messing everything up hahaha
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?
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 :)
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.
This shit format your disk
Awful method 😂 Deleting your partition to expand it. What!?
Semantics. You can't resize the partition without changing it.
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.
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.
This is a really good tutorial. The author is really cautious. Everything works fine for me, thank you.
thanks