特殊:Badtitle/NS100:CreateBootPartitionAfterInstall
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/CreateBootPartitionAfterInstall }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/af | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|Afrikaans| [[::CreateBootPartitionAfterInstall/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/ar | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|العربية| [[::CreateBootPartitionAfterInstall/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/az | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|azərbaycanca| [[::CreateBootPartitionAfterInstall/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/bcc | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|جهلسری بلوچی| [[::CreateBootPartitionAfterInstall/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/bg | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|български| [[::CreateBootPartitionAfterInstall/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/br | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|brezhoneg| [[::CreateBootPartitionAfterInstall/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/ca | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|català| [[::CreateBootPartitionAfterInstall/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/cs | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|čeština| [[::CreateBootPartitionAfterInstall/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/de | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|Deutsch| [[::CreateBootPartitionAfterInstall/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/el | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|Ελληνικά| [[::CreateBootPartitionAfterInstall/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/es | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|español| [[::CreateBootPartitionAfterInstall/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/fa | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|فارسی| [[::CreateBootPartitionAfterInstall/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/fi | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|suomi| [[::CreateBootPartitionAfterInstall/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/fr | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|français| [[::CreateBootPartitionAfterInstall/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/gu | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|ગુજરાતી| [[::CreateBootPartitionAfterInstall/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/he | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|עברית| [[::CreateBootPartitionAfterInstall/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/hu | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|magyar| [[::CreateBootPartitionAfterInstall/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/id | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|Bahasa Indonesia| [[::CreateBootPartitionAfterInstall/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/it | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|italiano| [[::CreateBootPartitionAfterInstall/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/ja | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|日本語| [[::CreateBootPartitionAfterInstall/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/ko | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|한국어| [[::CreateBootPartitionAfterInstall/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/ksh | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|Ripoarisch| [[::CreateBootPartitionAfterInstall/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/mr | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|मराठी| [[::CreateBootPartitionAfterInstall/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/ms | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|Bahasa Melayu| [[::CreateBootPartitionAfterInstall/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/nl | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|Nederlands| [[::CreateBootPartitionAfterInstall/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/no | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|norsk| [[::CreateBootPartitionAfterInstall/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/oc | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|occitan| [[::CreateBootPartitionAfterInstall/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/pl | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|polski| [[::CreateBootPartitionAfterInstall/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/pt | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|português| [[::CreateBootPartitionAfterInstall/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/ro | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|română| [[::CreateBootPartitionAfterInstall/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/ru | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|русский| [[::CreateBootPartitionAfterInstall/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/si | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|සිංහල| [[::CreateBootPartitionAfterInstall/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/sq | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|shqip| [[::CreateBootPartitionAfterInstall/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/sr | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|српски / srpski| [[::CreateBootPartitionAfterInstall/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/sv | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|svenska| [[::CreateBootPartitionAfterInstall/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/th | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|ไทย| [[::CreateBootPartitionAfterInstall/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/tr | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|Türkçe| [[::CreateBootPartitionAfterInstall/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/vi | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|Tiếng Việt| [[::CreateBootPartitionAfterInstall/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/yue | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|粵語| [[::CreateBootPartitionAfterInstall/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/zh | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|中文| [[::CreateBootPartitionAfterInstall/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/zh-hans | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|中文(简体)| [[::CreateBootPartitionAfterInstall/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CreateBootPartitionAfterInstall | UbuntuHelp:CreateBootPartitionAfterInstall | {{#if: | :}}CreateBootPartitionAfterInstall}}/zh-hant | • {{#if: UbuntuHelp:CreateBootPartitionAfterInstall|中文(繁體)| [[::CreateBootPartitionAfterInstall/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:CreateBootPartitionAfterInstall|:CreateBootPartitionAfterInstall|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :CreateBootPartitionAfterInstall/zh | | {{#ifexist: CreateBootPartitionAfterInstall/zh | | {{#ifeq: {{#titleparts:CreateBootPartitionAfterInstall|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:CreateBootPartitionAfterInstall|1|-1|}} | zh | | }}
- title Create boot partition after install
This is not finished (but then isn't this the nature of the web?) These procedures could damage the information on your computer. Make backups first. Be careful. Read the documentation, again. You have been warned. Twice.
!!! All device names (like /dev/sda1 and hd0,1) used in the tutorial need not to apply on your situation, do some research of your device names first and don't blindly copy every command from this tutorial !!!
This tutorial covers how to create a boot partition for an Ubuntu 8.04 install after installing the system without a boot partition. Why may you want to do this?
- If you get this error message after updating your linux kernel:
Error 18: Selected cylinder exceeds maximum supported by BIOS Needed for this tutorial are
- An Ubuntu live CD
- Basic knowledge of partitioning using GParted
- Some understanding of how to use the commandline
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 this is in 'System -> Administration -> Partition Editor' Resize the your main partition by adding 100mb of free space before this, turn this created free space in a partition as well. if you don't know how, read this howto HowtoPartition We now have 2 partitions on the main drive, in my case /dev/sda
- /dev/sda2 - 100mb new partition
- /dev/sda1 - 3,65gb linux installation partition
Disable the bootflag on /dev/sda1 and enable it on /dev/sda2 using the right-click menu in GParted Maybe it's possible to switch the names of /dev/sda2 and /dev/sda1, but i don't know how.. feel free to add this information!!
Moving files from existing /boot to new location
Now lets start a console
in the console type
sudo su
to become root, like this you can do all the root task without having to use 'sudo' all the time.
Mount drives
next is to make a directory to mount the two drives in.
mkdir /mnt/boot mkdir /mnt/root
and mount the two drives in here
mount /dev/sda2 /mnt/boot mount /dev/sda1 /mnt/root
Copy files
cp -r /mnt/root/boot/* /mnt/boot/
Remount the boot partition
Now whe are remounting the boot partition to be where /boot is, we need this for later to re-install grub
umount /dev/sda2 mount /dev/sda2 /boot
Editing the files from your Ubuntu install
Add /boot to your /etc/fstab
in the console write
gedit /mnt/root/etc/fstab
to edit the fstab file in your Ubuntu install and add the line
/dev/sda2 /boot ext2 defaults 0 0
or if you want to find out the UUID of the drive and use that in the fstab file, in the console type
blkid
in the output there will be
/dev/sda2: UUID="<some uid>" TYPE="ext2"
the line to add in /etc/fstab would now be
UUID=<uid found with blkid> /boot ext2 defaults 0 0
The UUID will be the same in the live cd environment as in your normal Ubuntu, so it's completely save to copy this value
Setting up GRUB
in the console write
gedit /boot/grub/menu.lst
gedit opens with the menu.lst file, find the part that says:
# groot=(hd0,0)
and change the line
# groot=(hd0,0)
to
# groot=(hd0,1)
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 8.04.1, kernel 2.6.24-21-generic root (hd0,1) kernel /vmlinuz-2.6.24-21-generic root=UUID=41f24518-160e-48a1-9bb1-295213e94a67 ro quiet splash initrd /initrd.img-2.6.24-21-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
run:
grub-install hd0,1
It will give an error about a filesystem, but in the output it also says you can ignore this
Reboot
reboot your system by typing
reboot
.
Take out the ubuntu live cd, and boot back to your normal system
voila, you now have a working /boot partition
Final Cleanup
You are now booted using your new /boot partition, but in the old /boot dir on the / (root) filesystem there are still the files used for booting before you had a separate partition for that. To clean this up, open up a console and type the following commands
umount /boot rm -rf /boot mkdir /boot mount /boot
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.
Maintenance
Remember when your install new linux kernel next time, you may need to reinstall grub after mounting your boot partition over /boot in the live-CD root as shown above.