cobrd
Posts: 5
Joined: Fri Jun 29, 2012 2:14 pm

Larger boot partition wanted

Tue Mar 12, 2013 3:13 pm

Why is the boot partition on RPi distros so small?

With an 8 GB SDHC card it could be expanded to well over 1 GB and still leave more space than you can shake a Python at on the main partition. It would also be a very easy way to transport files from a PC to a Pi and back again.

Does anybody know how to edit a .img file so it creates a larger /boot partition? Or how to create a new image with the right partitioning on it?

Re-partitioning an existing card using Gparted results in an unbootable card.

gamerb
Posts: 1
Joined: Fri Oct 12, 2012 3:26 pm
Contact: Website

Re: Larger boot partition wanted

Tue Mar 12, 2013 3:57 pm

The foundation uses only what the system needs for the boot partition the only way they would expand it is if the kernals get bigger and need more space.

There is a way to re-size and move partitions, depending what you are after.

To re-size and move the boot partition I would use GParted available for windows, Linux, and the Raspi.

Code: Select all

sudo apt-get install gparted
*Note: you can change the rootfs partition by typing:

Code: Select all

sudo raspi-config
And selecting expand rootfs

Thaddy
Posts: 173
Joined: Wed Mar 06, 2013 11:28 am

Re: Larger boot partition wanted

Tue Mar 12, 2013 4:18 pm

Current Raspbian offers to increase the sie on install. You probably missed that....
I can see no reason why gparted wouldn't work. It should.

Spid
Posts: 525
Joined: Sat Jan 19, 2013 12:47 pm

Re: Larger boot partition wanted

Tue Mar 12, 2013 4:21 pm

Q The boot partition only needs to be 60MB or thereabouts, so why would a bigger partition be required ?

A If you want to share files create a FAT32 Partition :mrgreen:
I will always assume you are running Raspbian for desktop and Raspbmc for XMBC !

Aydan
Posts: 689
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: Larger boot partition wanted

Tue Mar 12, 2013 4:28 pm

Spid wrote:Q The boot partition only needs to be 60MB or thereabouts, so why would a bigger partition be required ?

A If you want to share files create a FAT32 Partition :mrgreen:
This will work for Linux and probably for Mac but not for Windows. Windows only shows the first partition on a SD card.

I use either samba or winSCP to transfer files to/from the Pi

Regards
Aydan

cobrd
Posts: 5
Joined: Fri Jun 29, 2012 2:14 pm

Re: Larger boot partition wanted

Tue Mar 12, 2013 4:37 pm

Spid wrote:
A If you want to share files create a FAT32 Partition :mrgreen:
I've already got one - the boot partition - and it's not big enough. I use the Pi as a data logger and I need to collect logged data in the field with minimum hassle and no network.

User avatar
rpdom
Posts: 15019
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Larger boot partition wanted

Tue Mar 12, 2013 5:02 pm

Use a USB memory stick formatted to FAT32. Easiest way to do it.

Alternative is using Samba to create a MS compatible shared area.

User avatar
RaTTuS
Posts: 10415
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Larger boot partition wanted

Tue Mar 12, 2013 5:05 pm

livefs a windows bos with debian , ubuntu or something else
dd the 2nd partition [linux] off somewhere safe
copy the contents of partition 1 [vfat] off somewhere safe
fdisk the sd card to have your 1Gb w95 fat32 lba partition and a 2gb linux [or whatever your orginal size was]

format partiton 1 as vfat
copy vfat contents back onto partition 1
dd linux contents back to partition 2

put back in RPi and boot
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Spid
Posts: 525
Joined: Sat Jan 19, 2013 12:47 pm

Re: Larger boot partition wanted

Tue Mar 12, 2013 5:15 pm

Apologies forgot Windozy can not see all the partitions, glad i use Linux and OS X.................... :lol:
I will always assume you are running Raspbian for desktop and Raspbmc for XMBC !

OtherCrashOverride
Posts: 582
Joined: Sat Feb 02, 2013 3:25 am

Re: Larger boot partition wanted

Tue Mar 12, 2013 5:39 pm

The boot partition gets mounted at /boot in linux. Under normal circumstances, only root should have access to this area as its a security sensitive area. Since its only purpose is to boot the system, extra space allocated to it is wasteful. Using this area for other purposes compromises the security of the system.

If you are looking for an easy way to transfer files between the Pi and your Windows PC. I recommend Filezilla http://filezilla-project.org/. Enable ssh support on the Pi from the raspi-config menu. Then use Filezilla on your PC to connect to the Pi's IP address using any user account such as the default 'pi' user.

If you wish to transfer files without a network, then using a USB stick is still probably the best alternative.

User avatar
Jim Manley
Posts: 1600
Joined: Thu Feb 23, 2012 8:41 pm
Location: SillyCon Valley, California, and Powell, Wyoming, USA, plus The Universe
Contact: Website

Re: Larger boot partition wanted

Tue Mar 12, 2013 6:44 pm

FAT partitions don't provide the features for data reliability and access performance that ext3 and ext4 partitions do. FAT dates back to before 1981 when personal computer disks were much smaller and slower, had minimal caching available, didn't have much built-in intelligence, and drivers were simplistic since earlier OSes didn't make many demands on such devices. An ext3 or ext4 partition will be faster and more reliable than a FAT partition. A FAT partition is only used in this application (very common for single-board computers) because it makes it possible to build a system on a Windows machine, obviating the need to use a Linux system to prep the Pi (but that's also eminently doable). It's an artifact of the near ubiquity of Wintel-based hardware in large volumes at low cost for many years.

There are at least as many ways to skin this virtual cat as they have lives (don't worry Mooncake, no cats were even envisioned being harmed in the making of this post). You'll need to create an extra SD card or disk with the stock image to copy files from to the target card. You could then use a partition manager with the target SD card to set up the FAT boot partition to be whatever size you want, format it, then copy the /boot directory there, then create (ext3 or ext4 - the latter allows for recovery via journaling), size, and format the Linux partitions with appropriate amounts of space, and then populate them with the Linux system files as desired. As was noted, Windows will only recognize one FAT/FAT32 partition and it has to be the first partition.

Once a card has been set up, an image file can be generated that can then be used for a pristine backup and to create as many modded cards as anyone would ever want.
The best things in life aren't things ... but, a Pi comes pretty darned close! :D
"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!

xterm
Posts: 6
Joined: Tue Mar 12, 2013 2:30 am

Re: Larger boot partition wanted

Tue Mar 12, 2013 7:05 pm

Edit2: Sorry, but the following does not work! Everything is fine, except for the fact, that the newly created fat32-partition will not show up on a windows-machine ...

I suggest to leave the boot-partition as it is! Changing the size of the boot-partition is indeed absolutely possible and not too difficult but it would probably take a very long amount of time to do so and it would stress your sd-card unnecessarily.

A better solution is to shrink the main Linux-partition (probably ext4) at its end and then add a new fat32-partition in the free space.

This could be done with the program "gparted".

If not already installed, first install this:
sudo apt-get install dosfstools mtools

If gparted is not installed, install it with:
sudo apt-get install gparted

Then start it with:
sudo gparted

The usage of gparted is relatively self-explanatory, (well relatively ...)

First: Choose the correct device! If you do this on the rpi it will be something like "/dev/sda" not "/dev/mmcblk0"!.

You have to shrink the right-side (not the left-side) of the main linux-partition (ext4), so that the size of the remaining unallocated space is about 512 MB or whatever size you like, this also depends on how big your sd-card is. Don't shrink too much, there should always be enough unused space left on the main linux-partition for installing new programs and writing linux relevant data, otherwise raspbian or whatever os you have installed will not function properly.

Then click "Apply" to shrink the partition, on a freshly installed system this will take less than a minute.

After that you can add a new fat32-partition in the unallocated space on the right side, choose fat32, primary partition and give it a name (makes it easier to find it in the file-manager).

Click "Apply" to add the new fat32-partition, this should only take a couple seconds.

Well, there is one problem! You can not shrink the partition where you rpi-linux (e.g. raspbian) is currently running from!

If you want to do this on your RaspberryPi itself, you need an usb-cardreader and of course another sd-card with raspbian installed on it. Then you can boot from one sd-card, start gparted and change the partitions on the other raspian-sd-card in the usb-cardreader.

Before writing here, I tried this on my own rpi and the whole action was finished within 5 minutes, ... and of course raspbian was able to boot afterwards.

If you cant do this on your rpi, maybe because you don't have a second sd-card or you have power-problems, the next easiest way (imho) would be to download an Xubuntu-ISO, burn it on a CD, boot it on your desktop-computer, plug in your sd-card and start gparted from xubuntu.

If you start gparted on your desktop-computer, don't forget to choose the correct device first, (on the desktop it will probably not be "/dev/sda"!!! Check that the device has the right size, if it says something like 500GiB, then its most likely your windows-drive and not your sd-card, please do not fiddle with your windows-drive, gparted will happily assist you in making your windows-drive completely unbootable!

Edit:
I realised, that on a fresh raspbian you first need to install these two tools before gparted is able to create fat32-partitions:
sudo apt-get install dosfstools mtools
Last edited by xterm on Tue Mar 12, 2013 8:03 pm, edited 2 times in total.

Aydan
Posts: 689
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: Larger boot partition wanted

Tue Mar 12, 2013 7:12 pm

@xterm,

as has already been stated, your solution will not work for a windows machine, because windows only reads the first partition on a sd card.

User avatar
jojopi
Posts: 3079
Joined: Tue Oct 11, 2011 8:38 pm

Re: Larger boot partition wanted

Tue Mar 12, 2013 7:38 pm

Although the boot partition needs to be primary partition1, it does not need to be physically the first partition in terms of start sector. So to avoid moving the whole of partition2 to make room to extend partition1, you can just delete partition1 and then create a new partition1 after partition2. (And format and copy the boot files into the new partition, of course.)

Code: Select all

Disk /dev/mmcblk0: 7969 MB, 7969177600 bytes
4 heads, 16 sectors/track, 243200 cylinders, total 15564800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000dbfc6

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1   *     7616512    15564799     3974144    e  W95 FAT16 (LBA)
/dev/mmcblk0p2          122880     7577599     3727360   83  Linux

Partition table entries are not in disk order

xterm
Posts: 6
Joined: Tue Mar 12, 2013 2:30 am

Re: Larger boot partition wanted

Tue Mar 12, 2013 7:39 pm

Aydan wrote:@xterm,

as has already been stated, your solution will not work for a windows machine, because windows only reads the first partition on a sd card.
Edit: Yes thats true, forget the following...

The method I described, does not need a windows-machine at all, it works completely on the rpi itself, you just need a second sd-card and an usb-cardreader temporarily connected to the rpi!

I just assumed, that cobrd owns a windows-machine, and just for the case, that cobrd would be unable to do the partition-manipulations on the rpi itself (power-problems, no second sd-card, no usb-cardreader etc.), I suggested, that he could do the same thing on his windows-machine if he boots an Xubuntu-CD from that machine.
Last edited by xterm on Tue Mar 12, 2013 8:06 pm, edited 1 time in total.

User avatar
winkleink
Forum Moderator
Forum Moderator
Posts: 278
Joined: Mon Nov 07, 2011 9:12 am
Location: UK
Contact: Website

Re: Larger boot partition wanted

Tue Mar 12, 2013 7:46 pm

If it's Windows you want to access your Raspberry Pi then check out these solutions.
Basically, you can get file viewers for EXT2/3 partitions for Windows.

http://www.howtoforge.com/access-linux- ... om-windows

It means no need to reduce the size of your main partition giving maximum flexibility.
Twitter:Winkleink
Google+: Winkleink

xterm
Posts: 6
Joined: Tue Mar 12, 2013 2:30 am

Re: Larger boot partition wanted

Tue Mar 12, 2013 7:59 pm

Aydan wrote:@xterm,

as has already been stated, your solution will not work for a windows machine, because windows only reads the first partition on a sd card.
Ok, I see what you mean, my failure sorry!

I didn't try the sd-card on a real windows-machine, just plugged it into my linux-desktop where everything worked fine with the new fat32-partition, shame on me!

cobrd
Posts: 5
Joined: Fri Jun 29, 2012 2:14 pm

Re: Larger boot partition wanted

Wed Mar 13, 2013 7:34 pm

Thanks for all the points, guys.
And especially to jojopi, who hit the nail on the head.

Using Debian on a PC at work I was able to add a replacement boot partition at the end of my SD card, get it to show up as a 1.3 GB partition on Windows 7 and boot from it on a Pi.

I can now use the same technique with all my cards and make it operational.

xterm
Posts: 6
Joined: Tue Mar 12, 2013 2:30 am

Re: Larger boot partition wanted

Thu Mar 14, 2013 8:29 am

cobrd wrote:Thanks for all the points, guys.
And especially to jojopi, who hit the nail on the head. ...
Yes I tried jojopis method too, after I saw that my first solution didn't work. The trick is to delete the original boot-partition before you create the new expanded fat32-boot partition, otherwise the new boot-partition will be created in the wrong partition-slot, (3 instead of 1).

(If that happens it may be possible to change the partition numbering with sfdisk, but sfdisk is not really a beginners tool.)


I was a little bit frustrated when I realized, that it is still not possible to work with multi-partition sd-cards or usb-sticks in MS-Windows, not even in Windows 8!
I call this a bug, like others did before:
http://social.technet.microsoft.com/For ... 2d2cde1ee/

Today there are no more technical reasons for this, windows clearly can see multiple partitions on sd-cards but just refuses to map them respectively don't let the user assign driveletters to them.
There are several workarounds for the problem: Patched drivers, malfunctioning card-readers (make windows believe that it is dealing with an usb-hdd instead of an sd-card), firmware-patches (changes the removable media bit of an sd-card or usb-stick). But none of these workarounds seems to be really reliable or very easy to apply and I definitely will not search the Internet for a non-standard card-reader when all I have to do is to stick my multi-partition sd-card into an Ubuntu-Desktop! ... Or into a card-reader that is connected to a RasberryPi :-)

Nevertheless, if someone, for whatever reason, has created one or more additional MS-Windows compatible partitions on an sd-card, there is a not too complicated method to show these partitions in the Windows-Explorer.

You need a tool named Bootice, I guess the tool was mentioned one or two times here in the forum.

The tool is available here. (Decide on your own which source you trust most and consider a virus-scan!):

1.
http://www.lancelhoff.com/partition-a-u ... indows-xp/

2.
http://www.pendriveapps.com/bootice-par ... ot-sector/

3. This may be the original site:
http://bbs.ipauly.com/


Bootice needs no installation, I tested the V0.9.2011.0501 version on a WindowsVista64 system.

To show any windows-compatible partition on a multi-partition sd-card follow these steps:

1. Start Bootice with doubleclick, confirm admin-rights.
2. Select Destination Disk, (your sd-card).
3. Click on Parts Manager.
4. In Partitions Management click on ReFormat USB disk, (nothing will be formated).
5. Select USB-HDD mode (Multi-Partitions).
6. Choose the partition that you like to show up in Windows-Explorer.
7. Click on Set Accessible.
8. Click on Cancel and quit Bootice.

Note:
If you have changed the visible Partition of an sd-card with Bootice in MS-Windows, you have to change it back (to the boot-partition of your raspbian), after your work is finished, otherwise the sd-card will not boot again in the RaspberryPi!

Andrei
Posts: 18
Joined: Tue Nov 13, 2012 8:38 am

Re: Larger boot partition wanted

Mon Apr 15, 2013 8:01 am

If I understood correctly the above conversation, it is possible to create additional FAT32 partition and make it visible for windows while still be able to boot from another (original) FAT16 partition (which will not be visible for windows). If this is the case, could somebody provide exact instructions for how to achieve following configuration:

3 GB raspbian partition
1 GB FAT32 (visible for windows)
56 MB FAT16 boot partition (not visible for windows)

Let's assume that we have 4 GB card with raspbian fresh install (not expanded).

Return to “General discussion”