Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Chromebook expand/resize/grow partition rootfs

  1. #1
    Junior Member
    Join Date
    Sep 2015
    Posts
    9

    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
    ARM guy
    Join Date
    Feb 2014
    Posts
    205
    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
    Junior Member
    Join Date
    Sep 2015
    Posts
    9
    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
    Junior Member
    Join Date
    Sep 2015
    Posts
    9
    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
    Junior Member
    Join Date
    Jul 2013
    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
    Junior Member
    Join Date
    Sep 2015
    Posts
    9
    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
    Junior Member
    Join Date
    Sep 2015
    Posts
    9
    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 02:01 PM.

  8. #8
    Junior Member
    Join Date
    Jul 2013
    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
    Junior Member
    Join Date
    Sep 2015
    Posts
    9
    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
    Junior Member
    Join Date
    Jul 2013
    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.

Posting Permissions

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