FuturePilot / Pi2buntu

Script for creating a minimal Ubuntu image for the Raspberry Pi 2
GNU General Public License v2.0
3 stars 4 forks source link

Improvement #16

Open sghazagh opened 9 years ago

sghazagh commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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)