Results 1 to 17 of 17

Thread: Chromebook expand/resize/grow partition rootfs

  1. #1
    Join Date
    2015-Sep
    Posts
    10

    Exclamation Chromebook expand/resize/grow partition rootfs

    I've tried various means (gparted, another machine with gparted, cgpt repair, etc), however I have not found a way to expand the initial formatting of SD card (or USB) to the full disk space.

    I feel bad asking as a sysadmin myself, but i'm stuck between "bug" and "user error" what is the appropriate way to use full disk space on a chrombook kali install?

  2. #2
    Join Date
    2014-Feb
    Posts
    309
    well it would help to say which chromebook - not all of them have the same partition layout, so let's start with that first.

  3. #3
    Join Date
    2015-Sep
    Posts
    10
    I was unaware that they were different. The hardware i'm using is:

    Samsung Chromebook (Snow)
    64 gig Micro SD with Full sized SD adapter OR USB

    Like I said I can get it to boot, I see two partitions on the drive one with a chrome OS kernel and then another with the root system. I can send more specifics later today if necessary.

  4. #4
    Join Date
    2015-Sep
    Posts
    10
    output of fdisk from the chrome side.

    localhost ~ # fdisk -l

    Disk /dev/loop0: 3.1 GiB, 3301310464 bytes, 6447872 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
    Disk /dev/mmcblk0: 14.7 GiB, 15758000128 bytes, 30777344 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: 21D240CA-1FDB-B34E-A91A-AB0D1E27CC8F

    Device Start End Sectors Size Type
    /dev/mmcblk0p1 282624 22384639 22102016 10.6G Microsoft basic data
    /dev/mmcblk0p2 20480 53247 32768 16M ChromeOS kernel
    /dev/mmcblk0p3 26578944 30773247 4194304 2G ChromeOS root fs
    /dev/mmcblk0p4 53248 86015 32768 16M ChromeOS kernel
    /dev/mmcblk0p5 22384640 26578943 4194304 2G ChromeOS root fs
    /dev/mmcblk0p6 16448 16448 1 512B ChromeOS kernel
    /dev/mmcblk0p7 16449 16449 1 512B ChromeOS root fs
    /dev/mmcblk0p8 86016 118783 32768 16M Microsoft basic data
    /dev/mmcblk0p9 16450 16450 1 512B ChromeOS reserved
    /dev/mmcblk0p10 16451 16451 1 512B ChromeOS reserved
    /dev/mmcblk0p11 64 16447 16384 8M unknown
    /dev/mmcblk0p12 249856 282623 32768 16M EFI System

    Partition table entries are not in disk order.
    fdisk: cannot open /dev/mmcblk0rpmb: Permission denied
    Disk /dev/mmcblk0boot1: 2 MiB, 2097152 bytes, 4096 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
    Disk /dev/mmcblk0boot0: 2 MiB, 2097152 bytes, 4096 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
    Disk /dev/dm-0: 1.2 GiB, 1283457024 bytes, 313344 sectors
    Units: sectors of 1 * 4096 = 4096 bytes
    Sector size (logical/physical): 4096 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disk /dev/mapper/encstateful: 3.1 GiB, 3301310464 bytes, 6447872 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
    GPT PMBR size mismatch (14335999 != 122814463) will be corrected by w(rite).

    Disk /dev/sda: 58.6 GiB, 62881005568 bytes, 122814464 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: D1D77819-3AC7-C642-9275-F77561388380

    Device Start End Sectors Size Type
    /dev/sda1 8192 40959 32768 16M ChromeOS kernel
    /dev/sda2 40960 14335966 14295007 6.8G Microsoft basic data

  5. #5
    Join Date
    2013-Jul
    Posts
    12
    Outis, I am having the same problem (samsung chromebook / snow) with 32GB SD card. I can resize but once I do, the SD card won't boot. I have tried booting into kali with the default image and that works fine. Once in kali, I use gparted to extend the 2nd partition of my SD card (mmcblk1p2) and that works fine. Kali works fine and shows the extended file system if I run a "df". I can do a full install of kali (apt-get install kali-linux-full) and that runs just fine because it sees the expanded partition. However, once I reboot it won't boot again. I get the beautiful beep. Let me know what you come across. Thanks. And thanks Steev!

  6. #6
    Join Date
    2015-Sep
    Posts
    10
    continuing to look into this I think that I'm doing something wrong with the cgpt command

    Based on the build scripts this is how they initially define the size
    Code:
    echo "Creating image file for Exynos-based Chromebooks"
    dd if=/dev/zero of=${basedir}/kali-$1-exynos.img bs=1M count=7000
    parted kali-$1-exynos.img --script -- mklabel gpt
    cgpt create -z kali-$1-exynos.img
    cgpt create kali-$1-exynos.img
    
    cgpt add -i 1 -t kernel -b 8192 -s 32768 -l kernel -S 1 -T 5 -P 10 kali-$1-exynos.img
    cgpt add -i 2 -t data -b 40960 -s `expr $(cgpt show kali-$1-exynos.img | grep 'Sec GPT table' | awk '{ print \$1 }')  - 40960` -l Root kali-$1-exynos.img
    so based on this (and other threads) I tried to simply follow the instructions, everything in th "`" is just a command to get the size. Which leaves me with this:
    Code:
    cgpt add -i 2  -t data -b 40960 -s 122773471 -l Root /dev/sda #sda is where my drive is mounted in the system.
    that returns:
    Code:
    ERROR: Entry outside of valid region
    Does anyone know what this means? I have also seen on another thread that my GPT header may be messed up. i'm going to continue to research that as a possibility

  7. #7
    Join Date
    2015-Sep
    Posts
    10
    made progress, based on this thread:
    https://forums.kali.org/showthread.p...e-system/page2
    there were certain things that needed to happen:
    using a separate kali machine (because Chrome OS no longer has parted):
    Code:
    parted /dev/sdc #booting off of USB so this is how it was allocated
    show info 
    #some warning about GTP
    Do you want to fix? 
    Fix #this is important
    Then run
    Code:
    cgpt add -i 2  -t data -b 40960 -s 122773471 -l Root /dev/sdc
    this worked and showed the size expected
    after this
    Code:
    fsck /dev/sdc
    This errors out about bad magic superblock (which caused resize2fs to error with bad magic number)

    two steps forward and one step back. the device boots after

    Code:
    cgpt repair /dev/sdc
    cgpt add -i 1 -S 1 -T 5 -P 10 -l KERN-A /dev/sdc
    cgpt add -i 2 -S 1 -T 5 -P 5 -l KERN-B  /dev/sdc
    However it still does not accept the full size (probably due to resize2fs failing)

    EDIT
    To be clear the problem I now have is this:
    Code:
    resize2fs /dev/sdc
    resize2fs 1.42.12 (29-Aug-2014)
    resize2fs: Bad magic number in super-block while trying to open /dev/sdc
    Couldn't find valid filesystem superblock.
    Last edited by Outis; 2015-09-30 at 14:01.

  8. #8
    Join Date
    2013-Jul
    Posts
    12
    I think part of the problem might be that resize2fs does not support the btrfs filesystem that is on the root partition

  9. #9
    Join Date
    2015-Sep
    Posts
    10
    Cracked the code, see below.

    Basically here's the flow let me know if you have any questions:
    1. Zero out disk
    2. DD it over
    3. Check out the partitions
    4. Open up parted
    5. let parted fix the disk
    6. extend the data
    7. make it bootable
    8. mount the disk
    9. resize with btrfs
    10. unmount



    Code:
    dd if=/dev/zero of=/dev/sdb bs=2G
    dd if=kali-chromebook.img of=/dev/sdb bs=512k
    fdisk -l
    #complains about mismatch
    parted /dev/sdb
    (parted) print
    #Warning: Not all of the space available to /dev/sdb appears to be used, you can fix the GPT to use all of the space
    #(an extra 108478464 blocks) or continue with the current setting?
    #Fix/Ignore? 
    Fix
    cgpt add -i 2  -t data -b 40960 -s 122773471 -l Root /dev/sdb
    cgpt repair /dev/sdb
    cgpt add -i 1 -S 1 -T 5 -P 10 -l KERN-A /dev/sdb
    cgpt add -i 2 -S 1 -T 5 -P 5 -l KERN-B  /dev/sdb
    mount /dev/sdb2 /mnt
    btrfs filesystem resize max /mnt/
    umount /dev/sdb2

  10. #10
    Join Date
    2013-Jul
    Posts
    12
    Awesome Thanks! I'll give it a try. Just out of curiosity, what OS did you run all this code from? I had trouble getting "mount" to recognize btrfs during some of my testing.

  11. #11
    Join Date
    2013-Jul
    Posts
    12
    Awesome Outis! Worked like a champ. Now I feel like I'm getting my monies worth out of my SD card.

  12. #12
    Join Date
    2016-Jun
    Posts
    12
    Quote Originally Posted by Outis View Post
    Cracked the code, see below.

    Basically here's the flow let me know if you have any questions:
    1. Zero out disk
    2. DD it over
    3. Check out the partitions
    4. Open up parted
    5. let parted fix the disk
    6. extend the data
    7. make it bootable
    8. mount the disk
    9. resize with btrfs
    10. unmount



    Code:
    dd if=/dev/zero of=/dev/sdb bs=2G
    dd if=kali-chromebook.img of=/dev/sdb bs=512k
    fdisk -l
    #complains about mismatch
    parted /dev/sdb
    (parted) print
    #Warning: Not all of the space available to /dev/sdb appears to be used, you can fix the GPT to use all of the space
    #(an extra 108478464 blocks) or continue with the current setting?
    #Fix/Ignore? 
    Fix
    cgpt add -i 2  -t data -b 40960 -s 122773471 -l Root /dev/sdb
    cgpt repair /dev/sdb
    cgpt add -i 1 -S 1 -T 5 -P 10 -l KERN-A /dev/sdb
    cgpt add -i 2 -S 1 -T 5 -P 5 -l KERN-B  /dev/sdb
    mount /dev/sdb2 /mnt
    btrfs filesystem resize max /mnt/
    umount /dev/sdb2
    hi there, I need to resurect this, because I got a problem with resizing, I can not fix on my own...

    Everything works, till I let parted "Fix" my USB drive (32GB) - now I can not boot it anymore with the chromebook
    I try to follow the next step(s):

    cgpt add -i 2 -t data -b 40960 -s 122773471 -l Root /dev/sdb results in a :"ERROR: Entry outside of valid region
    ERROR: -i 2 -l Root -b 40960 -s 122773471 -t EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"

    cgpt show /dev/sdb returns:

    start size part contents
    0 1 PMBR
    1 1 Pri GPT header
    2 32 Pri GPT table
    8192 32768 1 Label: "kernel"
    Type: ChromeOS kernel
    UUID: 2AB71726-C5F4-FF4F-A206-F91EE59365CB
    Attr: priority=0 tries=0 successful=0
    40960 62474240 2 Label: "Root"
    Type: Linux data
    UUID: 9C347498-8108-6245-B0AE-3374B4A96494
    62517215 32 Sec GPT table
    62517247 1 Sec GPT header

    Now, how to set the right "region" for this?

    Hope somebody is willing to help, support is not that good, it seems...

    Cheers!

  13. #13
    Join Date
    2016-Jun
    Posts
    12
    ok, it does work now... somehow, I must have misread a thing or two... I already resized my partitions with gparted and there was no need to give cgpt orders to resize something...
    What was missing for a working install was just to add Kern A and Kern B, as described in the posts before.

    Now I got a 32GB size USB Kali install!!!

    Thanks

  14. #14
    Amazing! Thankyou so much!
    Made this on the SD card in running system (Samsung ChromeBook 1): Only had to change device name,
    adjust the -s parameter to match my SD card and use resize2fs to resize the kali partition (also in running system )

    So, for my 16GB Samsung SD card:

    Code:
    parted /dev/mmcblk1
    (parted) print
    #Warning: Not all of the space available to /dev/sdb appears to be used, you can fix the GPT to use all of the space
    #(an extra ...
    #Fix/Ignore? 
    Fix
    cgpt add -i 2  -t data -b 40960 -s 30000000 -l Root /dev/mmcblk1
    cgpt repair /dev/mmcblk1
    cgpt add -i 1 -S 1 -T 5 -P 10 -l KERN-A /dev/mmcblk1
    cgpt add -i 2 -S 1 -T 5 -P 5 -l KERN-B  /dev/mmcblk1
    resize2fs /dev/mmcblk1p2
    reboot

  15. #15
    Join Date
    2015-Sep
    Posts
    10
    thanks to EpsteinBzalder and Onkelpoe.

    had to wipe my USB, and now I'm back on the hunt for the right commands in the right order.

    happy to work with anyone from the kali team, everything else is rock solid... just seems like the chromebook is a bit difficult.

  16. #16
    Join Date
    2018-Jan
    Posts
    5

    Chromebook expand/resize/grow partition rootfs

    I tried the following apps ...

    Acronis disk director 9 = When selecting resize it only moves the partition around and doesnt resize it.

    QTParted = Able to resize but there is an error on completion and it aborts.

    GParted = Cant find the hdd or partitions.

    I have 15GB partition and 67GB of unallocated space on the hdd.

  17. #17
    Join Date
    2014-Feb
    Posts
    309
    Good news everyone! I've figured out a way to do it reliably.

    The following steps are expected to be taken from a Chromebook that is booted from an sdcard. Modify the device name if you're using USB.

    Code:
    mkdir growpart
    cd growpart
    apt download cloud-guest-utils
    dpkg-deb -x cloud-guest.utils .  #Note: The period at the end is not a typo and is required.  It's saying to extract into the current directory.
    cd usr/bin
    ./growpart /dev/mmcblk1 2 # You will need to make sure your sdcard is mmcblk1 - it'll typically be the only one in the output of ls /dev/mmcblk* that has 2 partitions.
    resize2fs /dev/mmcblk1p2 # Again, make sure you're using the correct partition.  Also note that while the command may seem to be "frozen" - it's working and may take a while.
    cgpt repair /dev/mmcblk1
    The cgpt repair line is required in order to correct the chrome gpt partition table. And again, make sure you wait for the resize2fs command to finish. There is no way to estimate how long it will take, but know that it IS working. Just let it sit until it's finished. I believe the output goes into dmesg output, but don't quote me on that.

Similar Threads

  1. Replies: 2
    Last Post: 2016-04-30, 16:43
  2. resize ssd after install using 16GB samsung chromebook
    By transcend in forum ARM Archive
    Replies: 11
    Last Post: 2015-09-15, 05:05
  3. Resize persistence partition
    By Ritashugisha in forum General Archive
    Replies: 0
    Last Post: 2014-05-29, 03:39
  4. Partition resize on Raspberry Pi
    By Toontje in forum ARM Archive
    Replies: 1
    Last Post: 2013-07-01, 22:22

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •