WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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

Offline code

  • Newbie
  • *
  • Posts: 22
How do you expand drive size?
« on: October 05, 2017, 03: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: 11044
Re: How do you expand drive size?
« Reply #1 on: October 06, 2017, 04: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, 12:37:46 PM »
What is the correct way to expand without deleting and making a new one?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14819
Re: How do you expand drive size?
« Reply #3 on: October 10, 2017, 01:30:07 PM »
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, 01:08:32 PM »
I searched but I can't find anything that explains how to do it. There were 2 threads found.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14819
Re: How do you expand drive size?
« Reply #5 on: October 11, 2017, 03: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.

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 713
Re: How do you expand drive size?
« Reply #6 on: October 11, 2017, 03: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, 10: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


Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 713
Re: How do you expand drive size?
« Reply #8 on: October 12, 2017, 10: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, 10:43:46 AM by patrikg »