Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement #16

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

Improvement #16

wants to merge 17 commits into from

Conversation

sghazagh
Copy link

Hi,
I have added few line of codes to improve the image creation process.
You do not need to fix the size of SD. Mine will calculate the rootfs size with minimum required free space (ext4 partition size) and add to bootsize (vfat partition size) and make the image size with combination of these two.

Also have control to change these values if required.
have used kpartx to use mapper instead of two losetup. Makes it easier...

cheers,
Saeid Ghazagh

@FuturePilot
Copy link
Owner

The fdisk part of your modifications is failing

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xf33c269e.

Command (m for help): Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): Partition number (1-4, default 1): First sector (2048-1820671, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-1820671, default 1820671): 
Created a new partition 1 of type 'Linux' and of size 64 MiB.

Command (m for help): Selected partition 1
Hex code (type L to list all codes): If you have created or modified any DOS 6.x partitions, please see the fdisk documentation for additional information.
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

Command (m for help): Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): Partition number (2-4, default 2): First sector (133120-1820671, default 133120): Last sector, +sectors or +size{K,M,G,T,P} (133120-1820671, default 1820671): 
Created a new partition 2 of type 'Linux' and of size 824 MiB.

Command (m for help): Partition number (1,2, default 2): 
The bootable flag on partition 1 is enabled now.

Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Invalid argument

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

@sghazagh
Copy link
Author

Hi,When did you check that?I have found a small typo error which has been fixed.I have checked several time and have used it an hour before.All are ok. Try again and you should be alright.This way is much easier and quicker.Let me know the result...

 On Tuesday, June 30, 2015 12:08 PM, Nick <notifications@github.com> wrote:

The fdisk part of your modifications is failingWelcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xf33c269e.

Command (m for help): Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): Partition number (1-4, default 1): First sector (2048-1820671, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-1820671, default 1820671):
Created a new partition 1 of type 'Linux' and of size 64 MiB.

Command (m for help): Selected partition 1
Hex code (type L to list all codes): If you have created or modified any DOS 6.x partitions, please see the fdisk documentation for additional information.
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.

Command (m for help): Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): Partition number (2-4, default 2): First sector (133120-1820671, default 133120): Last sector, +sectors or +size{K,M,G,T,P} (133120-1820671, default 1820671):
Created a new partition 2 of type 'Linux' and of size 824 MiB.

Command (m for help): Partition number (1,2, default 2):
The bootable flag on partition 1 is enabled now.

Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Invalid argument

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

Reply to this email directly or view it on GitHub.

@sghazagh
Copy link
Author

However, the message is right as the size change will be effected in next reboot.
By the way, this should be done automatically when you insert the SD before going to login prompt as it runs as root.
You should not manually run the script as the rootfs in mounted and partition table cannot be altered.
If you do that, when you get into the prompt and login with "pi" you should have your partition changed.

just clone the git, make the image, boot with SD and all should be ok... (tested couple of times)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants