Giter VIP home page Giter VIP logo

chromeos-resize's Introduction

Chrome OS Partition Resizer

This script resizes partitions of a Chrome OS. Typically, this will be used to dual/multi-boot Chrome OS and another operating system, but it can also be used to reclaim lost disk space.

Chrome OS enforces a particular disk layout and will "repair" its installation by formatting the disk and reinstalling if a partition is added or removed. This script resizes the partitions rather than creating new partitions to avoid triggering the "repair".

Chrome OS device disk layout chart from The Chromium Projects "Disk Layout" page

As shown in the chart, the kernel C (partition 6) and rootfs C (partition 7) partitions are unused by the device, so we can safely resize (and use) them. The user state partition (green, labeled "Encrypted user data") is used by Chrome OS to store user files, extensions, Android apps, etc. chromeos-resize redistributes space among these three partitions to the user's desire.

Using this script will delete all data on these partitions, including any downloads and files Chrome OS uses. Back up that data if it is important to you.

Purpose

Originally created to serve the Chromebook Pixel 2015 (samus) Linux community which noticed the need for Chrome OS to receive firmware updates.

Dual/multi-booting Chrome OS alongside other operating system(s) is useful for a number of reason:

  1. Only Chrome OS can provide firmware updates to Chrome OS devices.
  2. Chrome OS can run Android apps, offers excellent battery life, and works out-of-the-box without issues.
  3. Other operating systems can provide access to other types of software, a better development environment, more system control, etc.
  4. Natively installing another operating system can be more convenient or efficient than running one through e.g., crouton or connecting to another machine via ssh.

chromeos-resize can also be used to revert from a multi-boot system to one with only Chrome OS, or other variations. If, somehow, space on the disk was lost by another resizing, this will fix it.

Usage

Read through this entire section before resizing.

Considerations

Carefully consider how much space you are allocating to each partition! If you are unhappy with your partition sizes later, you will have to go through this process and lose all data on the three partitions again.

Chrome OS needs little space for itself, so it is recommended to minimize the space allocated to Chrome OS in order to maximize the space for the other operating system. Check how much space you are using in the user state partition by running $ df --human --output=used /dev/sda1 at the shell. If planning to install the Google Play Store for Android apps, no less than 3 GiB should be allocated to the user state partition. (Chrome OS and the Play Store without any Android apps use nearly 3 GiB.)

If kernel C will be used as a boot partition (recommended), enough space for multiple kernels should be allocated to it. The default of 64 MiB will be able to hold around eight versions of the Linux kernel--enough for most users.

After resizing the user state and kernel C partitions, all remaining space will be allocated to the rootfs C partition. Allocating less space to the user state and kernel C partitions will result in a larger rootfs C partition, and is therefore recommended for most use cases.

Resizing

First, enable Developer Mode on your Chrome OS device.

Next, get to the shell by pressing Ctrl+Alt+T then typing "shell" at the prompt. Once at the shell: download, read, and run cros-resize.sh.

$ cd ~/Downloads/
$ curl https://raw.githubusercontent.com/ethanmad/chromeos-resize/master/cros-resize.sh
$ sudo bash cros-resize.sh

Note that the script names partitions differently than does this document:

  • STATE is the user state or "stateful" partition,
  • KERN-C is the kernel C partition,
  • ROOT-C is the rootfs C partition.

Authors

License

This work is released under the GPL v3.

Copyright (c) 2016 Ethan Madison and Eric Hegnes

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

Thanks

Thanks to Jay Lee and the authors of chrubuntu-script for providing the inspiration and base for this project.

chromeos-resize's People

Contributors

eduardo06sp avatar ethanmad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

chromeos-resize's Issues

error

I tried on chromium, and it shows Ending LBA overlaps and -i 1 -l STATE -b 64 -s 61440000 as error message. Any chance you know what was happening?

Fails on Samsung ARM Chromebook

When I try to get more free space on my Samsung ARM based Chromebook by running cros-resize, I get this error and I don't know how to get this through. It worked fine on other Chromebooks.
ERROR: Entry outside of valid region
ERROR: -i 7 -l ROOT-C -b 19288064 -s 11489247

How can I run this on CloudReady when running of a USB?

Not really an issue... but
I installed CloudReady Home edition, and I am running this of an USB Drive because I still want to use the default Chrome OS.

I can't switch to Developer mode, because when it shows me the recovery screen after pressing Esc+Refresh+Power, it says the disk I inserted does not contain Chrome OS, with no way to let me press Control+D. (it says that because it detects my CloudReady drive).

However, I want to resize my partitions with this amazing tool that worked on non-CloudReady, but it is not letting me because I can't get in to Developer mode.

Use a resizing tool?

I wonder why you destroy the partitions instead of resizing them. IIRC GNU PartEd can do it.

(I'm researching if a ChromeBook would be ok for a dev environment, and it would be imperative to have a data partition that ChromeOS doesn't mess with and that would preferably show up in Crostini)

ERROR: Starting LBA overlaps

Im using a Pixelbook Go with the default options and get the error:

Unmounting stateful partition...
Editing partition table...
ERROR: Starting LBA overlaps
ERROR: -i 1 -l STATE -b 17092608 -s 10485760

Output of lsblk:

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 315.8M 0 loop
-encstateful 253:1 0 315.8M 0 dm /mnt/stateful_partition/encrypted loop1 7:1 0 486.1M 1 loop /opt/google/containers/android/rootfs/root loop2 7:2 0 4K 1 loop /opt/google/containers/arc-sdcard/mountpoints/container-root loop3 7:3 0 4K 1 loop /opt/google/containers/arc-obb-mounter/mountpoints/container-root loop4 7:4 0 9.2M 1 loop /usr/share/chromeos-assets/quickoffice/_platform_specific loop5 7:5 0 58.6M 1 loop sda 8:0 1 28.7G 0 disk -sda1 8:1 1 28.7G 0 part /media/removable/USB Drive
mmcblk0 179:0 0 58.2G 0 disk
|-mmcblk0p1 179:1 0 1.1G 0 part /mnt/stateful_partition
|-mmcblk0p2 179:2 0 16M 0 part
|-mmcblk0p3 179:3 0 4G 0 part
|-mmcblk0p4 179:4 0 16M 0 part
|-mmcblk0p5 179:5 0 4G 0 part
|-mmcblk0p6 179:6 16M 0 part
|-mmcblk0p8 179:8 16M 0 part /usr/share/oem
|-mmcblk0p9 179:9 512B 0 part
|-mmcblk0p10 179:10 512B 0 part
|-mmcblk0p11 179:11 8M 0 part
`-mmcblk0p12 179:12 32M 0 part
mmcblk0boot0 179:16 0 4M 1 disk
mmcblk0boot1 179:32 0 4M 1 disk
mmcblk0rpmb 179:48 0 16M 0 disk
zram0 252:0 0 11.3G 0 disk [SWAP]

Originally posted by @maxdruiz in #3 (comment)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.