reynhout / chrx

Chromebook Unix
422 stars 57 forks source link

Ability to remove linux partition #11

Closed DennisLfromGA closed 8 years ago

DennisLfromGA commented 8 years ago

It would be very handy to be able to remove the linux partition instead of having to do a full restore when things go awry or you decide you don't want/need it any longer.

Maybe adding a -D option or something similar to chrx-install and modifying chrx-setup-storage to remove the existing linux partitons (6 & 7) and give the space back to the stateful_partition (1) could be done.

I think this would be very useful for a lot of people.

Thanx for your consideration, DennisL

reynhout commented 8 years ago

I'm not sure I understand. If you want to completely reinstall Linux from scratch, you just need to re-run chrx. You can choose the same or different options, including distro.

But if you don't want Linux any more at all, it seems like reinstalling via the ChromeOS Recovery image makes the most sense. It only takes a few minutes and guarantees a fresh start.

Am I missing a use case?

DennisLfromGA commented 8 years ago

Yes, I understand the benefits of re-running chrx to install a different distro, etc.

And I guess reinstalling via the ChromeOS Recovery Utility makes the most sense for a completely fresh start but not all of us want to wipe our Chromebooks clean and start over. I have crouton chroots that autostart, custom scripts, .bash* config files, etc. I even have a CROUTON partition (13) where my chroots and other important files are stored -

/dev/root       1.2G  1.1G  165M  87% /
/dev/sda1        20G   14G  4.4G  76% /home
/dev/sda13       70G   57G  9.1G  87% /var/crouton
/dev/sda7        25G  9.8G   14G  42% /var/chrx
total           115G   82G   28G  76% -

I'm probably a different use case but I think others may have similar scenarios though not as much entrenched as mine. I like the dual-boot option that chrx affords me but I do Chromebook Central support too so I need to use Chrome OS a great deal also.

I just think an option to reset partitions 6 & 7 back to default would be valuable.

Thanx again for your consideration, DennisL

reynhout commented 8 years ago

Well, I can see how that feature would be useful to you, but I think yours is a rather unusual use case. Moving forward is common, moving backward is occasional, but moving back and forth is ... well, unique so far. :)

Mostly though, I'm hesitant to add a feature that doesn't fit the goals of the project and is unlikely to be tested properly and regularly -- particularly one that destroys data by design. I'll give it some more thought.

In the meantime, this is what I think you'll need to do (UNTESTED, danger danger, etc):

cgpt add -i 6 -t unused /dev/sda
cgpt add -i 7 -t unused /dev/sda
cgpt add -i 1 -s $(( $(cgpt show -i 1 -s /dev/sda) + $(cgpt show -i 6 -s /dev/sda) + $(cgpt show -i 7 -s /dev/sda) )) /dev/sda

And then tell the kernel to reread the partition table, and reboot:

blockdev --rereadpt /dev/sda
reboot

You might need to work around the fact that the partition you're resizing is mounted. Again, this is untested, and I'm not able to verify presently. But that will be the gist of it. Let me know if you give it a try.

DennisLfromGA commented 8 years ago

@reynhout,

Thanx very much for your consideration and explanation. I do understand and agree with your reasoning.

Thanx also for the recommended solution to my somewhat unique situation; I'll of course test it carefully but I think that's a very good solution. I've always had trouble with the calculations of sector sizes, start & end segments, etc. - I think I have a mental block about it for some reason. Your one-liner takes an approach I hadn't thought of and lets cgpt do all the work - cool! I don't currently have a need to use it but when I do I'll let you know how it goes.

I was an early adopter of ChrUbuntu and was disappointed when it stopped working on my non-SeaBIOS Acer C7, it seemed ChrUbuntu was more or less abandoned. I do appreciate all of Jay Lee's efforts though, he definitely got the ball rolling. I was able to get it working using a combination of an old script and a newer one that I kludged together using vbutil_kernel & a vmlinuz file. It works but barely...

'chrx' came along and saved the day for a lot of us and offered many more options and customizations - great work! I'm currently running Gallium OS (beta2 thanx to your help on reddit) on my Dell Chromebook 13 and enjoying it very much.

Thanx again, @DennisL

reynhout commented 8 years ago

Thanks for your kind words. GalliumOS is 1.0 today, so hit the dist-upgrade button! :)

knightlightfury commented 7 years ago

I got gallium with chrx though I'm a bit noobish and made it take up 9 GB of space completely draining my local data is there a way of deleting gallium without a recovery image because I tried that method though it says download interrupted, thanks

knightlightfury commented 7 years ago

Btw I have been seeing many people that have their download interrupted so an easier way to delete it would be much better.

reynhout commented 7 years ago

@knightlightfury The method described previously in this ticket might work. Otherwise, you'll need to download the Recovery Image.

knightlightfury commented 7 years ago

@reynhout Before messing up anymore, where do I insert the commands, crosh or the Ctrl Alt Arrow key thing console

knightlightfury commented 7 years ago

Hope it’s crosh because I’m pretty sure you can’t copy and paste in the other console

knightlightfury commented 7 years ago

It doesn't work :(

johanneswilm commented 6 years ago

@reynhout I am also trying to do this. Not sure what isn't working. I manage to set the size of the 1st partition to be the size of partion 6 + 7, but then it ends there. partition 6 and partition 7 still seem to have their own size -- so I guess partition 1 and 6/7 are now on top of each other? From the partitioning script to judge, the original size of partitions 6 and 7 was 1. Would it help to move their start and set their size to 1?

I have also tried doing this from an Ubuntu installation installed on a usb stick, and that way I avoid the mount issues when rereading the partition table of the internal /dev/mmcblk0, but when restarting, the partition sizes are back to what they were.

tilda commented 6 years ago

Sorry for bumping a super old issue, but has anyone tried that removes the partitions? I don't have any spare USB or anything to use.