WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How do you expand drive size?  (Read 4297 times)

Offline code

  • Newbie
  • *
  • Posts: 22
How do you expand drive size?
« on: October 05, 2017, 12:57:49 PM »
This isn't exactly a Tinycore problem but I can't figure out how to expand the drive size.

Code: [Select]
# Create drive to VM
qemu-img create -f qcow2 test.qcow2 3G

# Download Live-CD
wget http://tinycorelinux.net/6.x/x86/release/Core-6.4.1.iso

# Start the VM with Live-CD and drive
qemu-system-x86_64 -cdrom Core-6.4.1.iso -m 512 -hda test.qcow2 --boot d
# If you don't have qemu-system-x86_64 use qemu-system

# Frugal Install
tce-load -wi tc-install
sudo tc-install.sh
c -> f -> 1 -> 2 (sda) - > y -> 3 (ext4) -> enter -> y -> enter

# Shutdown to restart without the disc
exitcheck.sh

# Run without Live-CD
qemu-system-x86_64 -m 512 -hda test.qcow2

# Currently system has 3 GB available
df

# shutdown to expand drive (.qcow2 file)
exitcheck.sh

# Increase drive size
qemu-img resize test.qcow2 +5G

# If you start is now `df` output will look the same

# Run with Live-CD to umount and expand available drive
qemu-system-x86_64 -cdrom Core-6.4.1.iso -m 512 -hda test.qcow2 --boot d

# Enter the following boot codes
mc base norestore

# Expand the partition
sudo fdisk /dev/sda

p -> d -> n -> p -> 1 -> enter -> +8GB -> w

sudo reboot

# Enter the following boot codes
mc base norestore

# Expand the file system
tce-load -wi e2fsprogs.tcz
sudo e2fsck -f /dev/sda1
sudo resize2fs /dev/sda1

# shutdown
exitcheck.sh

# Run without Live-CD and it won't boot
qemu-system-x86_64 -m 512 -hda test.qcow2

# No bootable device.

https://gist.github.com/Siecje/42233192cabd6703fb208000b7e11a8e#file-shell-sh-L37

It all seems to work but on reboot the system is broken.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10957
Re: How do you expand drive size?
« Reply #1 on: October 06, 2017, 01:09:02 AM »
Because you deleted the partition, you lost the "active/bootable" flag, at least. It's also not necessary to reboot between fdisk and resize2fs.
The only barriers that can stop you are the ones you create yourself.

Offline code

  • Newbie
  • *
  • Posts: 22
Re: How do you expand drive size?
« Reply #2 on: October 10, 2017, 09:37:46 AM »
What is the correct way to expand without deleting and making a new one?

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: How do you expand drive size?
« Reply #3 on: October 10, 2017, 10:30:07 AM »
Did you search the forum using “re-size partition”?

Offline code

  • Newbie
  • *
  • Posts: 22
Re: How do you expand drive size?
« Reply #4 on: October 11, 2017, 10:08:32 AM »
I searched but I can't find anything that explains how to do it. There were 2 threads found.

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: How do you expand drive size?
« Reply #5 on: October 11, 2017, 12:02:18 PM »
You can use gparted if you prefer a gui or use the readme for the piCore installation, which gives the general idea for a cli.

Online patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 662
Re: How do you expand drive size?
« Reply #6 on: October 11, 2017, 12:34:23 PM »
And also like that @curaga says.
Don't forget to set the bootflag of the new partition.
Because when in picore.. the first partition is not used for root, just fat formatted firmware and kernel partition.

-------------------------
Because you deleted the partition, you lost the "active/bootable" flag, at least. It's also not necessary to reboot between fdisk and resize2fs.

--------------------------

Offline code

  • Newbie
  • *
  • Posts: 22
Re: How do you expand drive size?
« Reply #7 on: October 12, 2017, 07:02:18 AM »
Thanks my problem was not setting the bootflag on the new partition. Oddly the piCore README doesn't include this step either.

http://tinycorelinux.net/9.x/armv6/releases/RPi/README

In case it is helpful to someone in the future, here is how I am expanding the drive size.

https://gist.github.com/Siecje/42233192cabd6703fb208000b7e11a8e


Online patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 662
Re: How do you expand drive size?
« Reply #8 on: October 12, 2017, 07:20:35 AM »
It's not there, because is not the boot active first partition (1) you have to expand.
It's root partition (2), you have to expand.


« Last Edit: October 12, 2017, 07:43:46 AM by patrikg »