Thursday, May 28, 2009

Linux partition advice

When I first partioned my disk I put /boot on the first partition and gave it 96M, following some advice found online I assume. This is not enough. I suggest giving it 256M. It is still a fraction of your hard disk. And because /boot is special it is impossible, or at least complex, to move some files to other partitions and link to them.

About a week ago ubuntu upgrade started complaining about a kernel upgrade problem. I ignored it for a few days assuming it would sort itself out. But it kept happening. Then when I viewed details of the upgrade I noticed (just briefly before it vanished off-screen) it was saying not enough diskspace on /boot.

Not again! When I tried to upgrade from Ubuntu 7 to Ubuntu 8 lack of space on /boot caused problems then too.

Poking around I also found I still had linux-generic packages installed, even though I'd switched to the linux-server kernel (see 6Gb on 32-bit linux). I deleted all packages that had the word "generic" in their name. After a reboot I still had one "generic" file left in /boot which I then just deleted. There was also a *.bak file for my current kernel. Datestamp was for a week ago, so I deleted that too.

It doesn't look like I've broken anything, and I'm now down to using 40M on /boot with 48M free (and I still have Ubuntu 7's linux-server kernel in there, which I think is now pointless, so I could reduce it even more).

Therefore, you can get away with a mere 96M /boot partition, it just requires more time and effort.

Conversely, I think a /boot partition above a certain size (1G?) causes problem at boot time, which is the whole reason for have a separate /boot partition. But I'm no expert, and that may be old-fashioned advice, and every BIOS on every motherboard made in the last 10 years may in fact be fine.

I dunno, and am too busy with more interesting stuff to study up on it, which is why I'll go for a 256M partition on my next computer.

3 comments:

keith.s.wilkinson said...

You may need a separate Ext2, Ext3 (or such legacy file system) /boot partition for GRUB Stage2 and the kernel if other partitions have file systems that GRUB Stage2 can't understand -- like RAID or LVM or Ext4.
The Stage1 boot code *either* goes in the MBR *or* at the beginning of the /boot partition -- and in this latter case, to be bootable, it should be made a Primary partition and be flagged as the *Active* Primary partition.
Although it's unlikely that the contents of your boot partition will grow to anywhere near 150MB, some modern distros like Fedora require that /boot be a minimum of 150MB or they won't install.
Since /tmp and /var may fill up, it's a good idea to make them separate partitions; /usr can be made read-only (for security) if on a separate partition; and
a separate /home partition makes backup easier.

darren said...

Hi Keith,
Thanks for letting me know about the 150M minimum in Fedora. Like I said, I'll probably go with 256M next time.

>Since /tmp and /var may fill up...

Yes, I hear this a lot. The counter-argument is that if you have lots of partitions you increase the chances of filling them up, because they're too small! Sorting that mess out is very time-consuming. Been there, done that. I've come to the conclusion I cannot accurately predict the future.
(My home directory is a separate partition, so I could encrypt it, and I did indeed make it too small!!)

Luke said...

On modern systems, I don't see the point of keeping it separate from the / partition.

Almost any BIOS on a usable computer today will take it wherever you put it, no matter partition size or location.

If you're concerned about a newer file system (such as ext4 or reiser) causing problems for GRUB, don't be. This is what GRUB Stage 1.5 is for.
On Ubuntu 9.04 `ls -1 /boot/grub/*stage1_5' gives:

/boot/grub/e2fs_stage1_5
/boot/grub/fat_stage1_5
/boot/grub/jfs_stage1_5
/boot/grub/minix_stage1_5
/boot/grub/reiserfs_stage1_5
/boot/grub/xfs_stage1_5

~ Luke