View Full Version : resize ssd after install using 16GB samsung chromebook

2014-02-27, 22:56
Installed this image kali-linux-1.0.6a-chromebook-arm-samsung.img to 16GB SSD.

Works fine, but how to resize the 8GB image to use entire space? Seems most kali tools will not install due to lack of space making it mostly unusable as is. Anyone conquer this problem?

I tried to follow various methods posted around such as this one but can't get it to work.

2014-02-28, 17:00
just to clarify, aim is to use internal flash memory card. I can resize and use full card when plugged in. I can also get internal to use the 8GB image, but resizing it afterwards is the challenge.

2014-03-02, 06:22
If you want to resizing the image won't work, unfortunately. I do have plans to make the scripts more robust - the biggest issue is that most SD cards aren't the full size they claim to be. A 16GB sdcard can be anywhere from 12-18GB in size.

What you'd want to do would be something like this:

Assuming your sdcard is /dev/sdc

dd if=/dev/zero of=/dev/sdc bs=1M count=4
parted /dev/sdc --script -- mklabel gpt
cgpt create -z /dev/sdc
cgpt create /dev/sdc

cgpt add -i 1 -t kernel -b 8192 -s 32768 -l U-Boot -S 1 -T 5 -P 10 /dev/sdc
cgpt add -i 2 -t data -b 40960 -s 32768 -l Kernel /dev/sdc
cgpt add -i 12 -t data -b 73728 -s 32768 -l Script /dev/sdc
cgpt add -i 3 -t data -b 106496 -s `expr $(cgpt show /dev/sdc | grep 'Sec GPT table' | awk '{ print \$1 }') - 106496` -l Root /dev/sdc

mkfs.ext2 /dev/sdc2
mkfs.ext4 /dev/sdc3
mkfs.vfat -F 16 /dev/sdc12

then you'd want to mount the image you've downloaded, as well as the sdcard partitions:

loopdevice=`losetup -f --show kali-1.0.6-chromebook.img`
device=`kpartx -va $loopdevice| sed -E 's/.*(loop[0-9])p.*/\1/g' | head -1`

mkdir -p /mnt/chromebookimg/{rootp,bootp,scriptp}
mount $bootp /mnt/chromebookimg/bootp
mount $rootp /mnt/chromebookimg/rootp
mount $scriptp /mnt/chromebookimg/scriptp

mkdir -p /mnt/sdcard/{rootp,bootp,scriptp}
mount /dev/sdc2 /mnt/sdcard/bootp
mount /dev/sdc3 /mnt/sdcard/rootp
mount /dev/sdc12 /mnt/sdcard/scriptp

You can just copy the contents across for bootp and scriptp, but you'll want to rsync the contents of rootp, so

cp -a /mnt/chromebookimg/scriptp/* /mnt/sdcard/scriptp/
cp -a /mnt/chromebookimg/bootp/* /mnt/sdcard/bootp/
rsync -HPavz /mnt/chromebookimg/rootp/* /mnt/sdcard/rootp/

The rsync command will take a while because it's syncing the files to the sdcard which will depend entirely on the speed of your sdcard and sdcard reader/writer.

Once they are done, run sync, and then unmount everything

umount $bootp $rootp $scriptp /mnt/sdcard/{bootp,rootp,scriptp}

And finally, we need to write the bootloader to the sdcard's first partition, so you'll need to run

wget -O - http://commondatastorage.googleapis.com/chromeos-localmirror/distfiles/nv_uboot-snow.kpart.bz2 | bunzip2 > nv_uboot-snow.kpart
dd if=nv_uboot-snow.kpart of=/dev/sdc1

Once this is done, you should be able to pop the sdcard out and when you boot the chromebook, assuming you've already put it in developer mode, and run the command to enable booting from usb, hit ctrl+u with the sdcard plugged in.

2014-03-13, 02:55
I used these instructions with the updated 1.0.6a chromebook image, and it worked quite nicely. Thanks for the writeup Steev.

2015-09-09, 06:32
Hello Steev

I hope you can help me as I think I ran into a similar issue.
I am using a 64GB SAMSUNG Sd card where I installed the kali image with Win32DiskImager on an ASUS Chromebook Flip.
The image is kali-2.0-veyron.img
The issue is that the image allow only 6 or 7GB on the FS partition leaving the rest of the space unusable.
Of course when I tryied to install kali linux full I run out of space and couldn't complete the installation.
I tryed to resize the FS with Gparted after having installed btrfs-tools but it doesn't work because after this operation the sd card isnt bootable any more.

This thread seems the most close solution corresponding to this issue however I am stuck here:

mount $bootp /mnt/chromebookimg/bootp
mount $rootp /mnt/chromebookimg/rootp
mount $scriptp /mnt/chromebookimg/scriptp

As I get an error messege which says that the device (2 out of 3 devices actually created above) doesn't exist:
mount: special device /dev/mapper/loop0p3 does not exist
mount: special device /dev/mapper/loop0p12 does not exist

Actually looking into the /dev/mapper directory I can't see any of the xxxxp3 or p12 devices.

Any idea what I am doing wrong?



2015-09-10, 05:55
Correct - in the veyron image there are only 2 partitions - 1 and 2 - 1 is the kernel partition and shouldn't be touched, 2 is the root partition and should be able to be resized to a larger size.

The loopback devices only show up when mounting the image itself, rather than the sdcard. you have to tell gparted to IGNORE any errors that it comes across with regards to the GPT - and NOT resize the second partition all the way (leave about 64-100mb at the end for the backup gpt table), and that should work.

2015-09-12, 10:28
First of all thank you very much to take the time to answer.

I would appreciate if you could give me few more clarifications. How would you actually tell gparted to ignore all errors ref GPT?
When I first tryied to use gparted to resize the FS partition I didn't came across any error in relation to GPT.
Also when I resized I went from roughly 6GB to 15GB leaving the rest unallocated (+/- 45GB).
Do I need to start from the code of your earlier post and adapt?
Would you be able to indicate me some more oprational steps ?


2015-09-12, 17:39
Thanks steev. I'd also be interested in what the updated kali 2.0 version of these instructions are. I am currently trying to extend my partition on a samsung chromebook. If I run parted and extend my partition 2 (leaving about 1GB of a 32GB card at the end), I end up with a system that won't boot. Any pointers here. Thank you very much!

2015-09-14, 05:18
Which chromebook cminus? Not all of them are partitioned the same.

2015-09-14, 12:18
Thanks steev! This is actually a first gen samsung chromebook (snow). I've been using kali 1.0 on an 32GB SD card and it has worked beautifully. I followed the steps here to get the card extended without any trouble (https://forums.kali.org/showthread.php?1012-Chromebook-SD-install-only-showing-5GB-file-system). Now, after I reimage the card with kali 2.0, trying to translate those same instructions. Of course, while that post references adjusting partition 3 I have tried to do the same for partition 2 on kali 2.0 but then resize2fs doesn't work for btrfs. I have also just booted into kali with the smaller image without touching the partition table and used gparted within kali 2.0 on the samsung chromebook and I can extend and everything seems to work fine until I reboot and then it won't boot after that. Any pointers on how to get kali 2.0 on a 32GB SD card for the Samsung (snow) chromebook and also extend so the whole card is usable? Thank you very much steev!!!!

2015-09-14, 16:49
You'd probably just need to run something like "btrfs filesystem resize +SIZE /dev/DEVICE" where SIZE is the size to increase it by, and DEVICE is the 2nd partition.

2015-09-15, 05:05
Thanks, no luck. For some reason, no matter what I try, I wind up with a SD card that won't boot. The original dd operation for the image from the kali site works like a champ but the minute I try to resize the 2nd partition, it ceases to boot. I'll keep trying I guess. Thanks!