Linux create boot partition

Set Bootable Partition Command Line

How to I set the bootable partition using the command line in parted? Ideally I would like a numbered list so I can select which partition to boot from easily.

How to set a partition flag is explained in the manual and should be a trivial task. You can’t have numbered lists when you set a flag but you can always print the device layout (which is a numbered list) and inspect it before setting any flags.

3 Answers 3

I use fdisk. before to apply this I recommend to work with a live CD or USB and back up your data.

First check if any bootable partition is present like in my system wich «/dev/sda1» is the bootable partition :

fdisk -l /dev/sda Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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: 0x00003256 Device Boot Start End Blocks Id System /dev/sda1 * 2048 959991807 479994880 83 Linux /dev/sda2 959993854 976766975 8386561 5 Extended /dev/sda5 959993856 976766975 8386560 82 Linux swap / Solaris 

If there is not any boot partition do like this with root login :

fdisk /dev/sda Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help): a Partition number (1-5): 

You’ve to type 1 if you want to make bootable the partition 1 or and following 2 if you want to make bootable the second partition etc.

and aply the modification with «w» like this

For modify the table of your disk and make the desired partition bootable.

Источник

CreateBootPartitionAfterInstall

This tutorial covers how to move the boot partition for an Ubuntu 10.04 install after installing the system without a separate boot partition.

Easy way

http://pix.toile-libre.org/upload/original/1342472594.png?200

Manual way

Info <! data-lazy-src=

Preparations

Booting the Ubuntu Live CD

Boot from the Ubuntu Live CD as you would normally, select your language and choose the ‘Try Ubuntu’ option

Creating a partition for /boot

Once your system has booted from the live CD open GParted via the ‘System -> Administration -> Gparted Partition Editor’ menu.

Unmount the swap partition: Highlight it, then Partition -> Swapoff

  • On older systems or very large drives, ensure the boot partition is within the area recognised by the BIOS. Check the BIOS settings for the reported disk size. It may be necessary to place the new boot partition before the Linux/Ubuntu partition in order for the BIOS to see it.

For guidance on creating partitions read this: HowtoPartition

  • /dev/sda2 — 200 MB (minimum) new boot partition
  • /dev/sda1 — 10 GB linux installation partition

Info <! data-lazy-src=

Open a terminal via Applications -> Accessories -> Terminal To run commands as ‘root’ for the commands in this guide without using ‘sudo’: sudo su

Mount drives

Make the mount points. In this guide, we will mount the main Ubuntu partition on /mnt/main, and the new boot partition on /mnt/boot

mount /dev/sda2 /mnt/boot mount /dev/sda1 /mnt/main

Copy /boot files

Remount the boot partition

Unmount the boot partition from /mnt and remount to /boot:

umount /dev/sda2 mount /dev/sda2 /boot

Editing the files from your Ubuntu install

Add /boot to your /etc/fstab

If you want to find out the UUID and confirm the format of the /boot partition type:

blkid -c /dev/null | grep "/dev/sda2"

The output should look similar to:

Open /etc/fstab for editing:

Info <! data-lazy-src=

Setting up GRUB Legacy

Edit /boot/grub/menu.lst

gedit opens with the menu.lst file,

find the part that says: /boot defaults 0 0 Example: UUID=0d5f0b33-c9c2-4b10-873b-7e9df9448df4 /boot ext3 defaults 0 0

# groot=(hd0,0) You have now unmounted the boot partition,> deleted all the files from /boot in the / (root) filesystem.> recreated the /boot dir as empty dir.> remounted the boot partition.

Next, update the boot entries at the end of the file. Since you now have a /boot partition, all kernel and initrd paths are relative to /boot/ instead, eg.

title Ubuntu 10.04, kernel 2.6.32-27-generic root (hd0,1) kernel /vmlinuz-2.6.32-27-generic root=UUID=41f24518-160e-48a1-9bb1-295213e94a67 ro quiet splash initrd /initrd.img-2.6.32-27-generic quiet

Update root to match that of groot above and remove /boot from the kernel and initrd paths in all the entries.

Reinstall grub

sudo grub grub> root (hd0,1) grub> setup (hd0)

remember in the setup command do not use hd0,1 as you need to install grub in the master boot record not in this specific partition boot record.

Reboot

Reboot your system by typing: reboot You will be asked to remove the CD and press «ENTER» before the system will reboot.

Final Cleanup

You are now booted using your new /boot partition but in the old /boot folder and files still exist on the / (root) filesystem.

To clean this up, open up a terminal and type the following commands to unmount the /boot partition, make a backup copy and then delete the old /boot folder*, recreate the /boot folder, and remount the new boot partition:

Maintenance

If using Grub legacy (not Grub 2), when you install a new linux kernel you may need to reinstall grub after mounting your boot partition over /boot in the live-CD root as shown above.

CreateBootPartitionAfterInstall (последним исправлял пользователь yannubuntu 2012-09-03 14:19:01)

The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for details

Источник

Creating a dedicated grub partition before installing ubuntu

I have suffered from boot configuration a lot. If windows is installed above ubuntu, ubuntu doesn’t boot. if ubuntu is installed above windows then windows goes away. Of course, reinstalling grub fixes these things, but I suppose having a dedicated grub partition is going to help me a lot. So I have fresh windows installed. I am about to install ubuntu 11.04. But before I install Ubuntu, I want to create a dedicated boot partition first. I thought creating a separate partition of about 200 mb and mounting it as /boot was called dedicated partition but it seems it is not. How to create a dedicated boot partition during ubuntu installation?

Читайте также:  Linux cups нет ppd

2 Answers 2

Another option is to make a dedicated Grub2 partition (as opposed to dedicated /boot partition you mount at boot), see herman’s tutorial.

Advantage: you can remove/install OSes at will.

Disadvantage: you need to edit the grub.cfg file manually. To avoid having to do that after every kernel update I recommend using the link to kernel images, not the kernel image itself, for example use something like

linux /vmlinuz root=UUID=3e4xxxxx-027b-407c-ba1a-xxxxxxxx ro quiet splash 
linux /boot/vmlinuz-2.6.35-28-generic root=UUID=3e4xxxxx-027b-407c-ba1a-xxxxxxxx ro quiet splash 

For more info on using symbolic links instead of full paths for kernel images look here.

Disadvantage2 (thanks psusi): when installing a new OS make sure you do not install its Grub image to MBR. Install it without Grub and then manually edit the grub.cfg file to include the new OS.

The guide you pointed, says to type sudo grub-install —root-directory=/media/grub2 /dev/sda as a command. But from where to input this command, is it ok if i do from the ubuntu’s live cd.

It doesn’t matter, but you have to make sure /media/grub2 or whatever is your dedicated Grub2 partition (Grub2 will install the config and module files there) and /dev/sda is the disk you want to boot from (Grub2 boot image will be installed into the first sector there).

On the mean time, I installed ubuntu, and haven’t defined any partition to be mounted as /boot, so the /boot is inside the file system also. Will the above guide still be valid or I have to ask another question.

Yes, the whole point of this is that the Grub doesn’t use the files in /boot of your Ubuntu installation, but its own (very small) extra partition (as explained in the link).

@Starx if you don’t tell the mint installer to NOT install grub, then yes, it will take over, just as it would without the dedicated grub partition.

Only if we need the master boot record of a harddrive for something else we may install Grub to a partition. Otherwise it is not a good idea to do so.

During boot-up a boot manager such as Grub is expected on the boot device. That usually is the MBR of the hard drive (which is different to a partition), e.g. /sda (not /sda1 ).

During installation Grub2 will recognize other operating systems on all drives attached and adds them to the boot menu choice (this can also later be done with sudo update-grub ). The Windows boot manager does not do so — that is why we are unable to boot into Ubuntu when having installed Windows later.

There are several guides on how to partition your drives for dual booting, e.g. linked to in answers to this question (or more).

For recommendations on a separate /boot partition see this question.

Источник

Оцените статью
Adblock
detector