Changes between Version 20 and Version 21 of TipAndDoc/boot/GRUB


Ignore:
Timestamp:
Nov 25, 2011 11:49:00 PM (12 years ago)
Author:
mitty
Comment:

move from ../

Legend:

Unmodified
Added
Removed
Modified
  • TipAndDoc/boot/GRUB

    v20 v21  
    22 
    33 = Kernel Boot Options = 
    4  == GRUB == 
    54 * https://help.ubuntu.com/community/Grub2 
    65 
     
    2221 > GRUB_CMDLINE_LINUX_DEFAULT="quiet nosplash" にすればOKでした。 
    2322  * "nosplash"だけでも可 
     23 
     24 = reduce grub entry = 
     25 * WindowsとLinuxのマルチブート -> Windowsを消してシングルブート化 
     26 
     27 1. 元の状態 
     28  * fdisk -lu /dev/sda 
     29{{{ 
     30Disk /dev/sda: 120.0 GB, 120034123776 bytes 
     31255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors 
     32Units = sectors of 1 * 512 = 512 bytes 
     33Sector size (logical/physical): 512 bytes / 512 bytes 
     34I/O size (minimum/optimal): 512 bytes / 512 bytes 
     35Disk identifier: 0x36ea3e05 
     36 
     37   Device Boot      Start         End      Blocks   Id  System 
     38/dev/sda1              63      524351      262144+  82  Linux swap / Solaris 
     39Partition 1 does not end on cylinder boundary. 
     40/dev/sda2          524352    42467392    20971520+   7  HPFS/NTFS 
     41/dev/sda3        42467393   234441647    95987127+  83  Linux 
     42}}} 
     43  * OSのインストールは、Windows 7 -> Ubuntu 10.04の順 
     44  * grep menuentry /boot/grub/grub.cfg | tr \" \' | cut -d\' -f2 
     45{{{ 
     46Ubuntu, with Linux 2.6.32-33-generic 
     47Ubuntu, with Linux 2.6.32-33-generic (recovery mode) 
     48Ubuntu, with Linux 2.6.32-32-generic 
     49Ubuntu, with Linux 2.6.32-32-generic (recovery mode) 
     50Ubuntu, with Linux 2.6.32-31-generic 
     51Ubuntu, with Linux 2.6.32-31-generic (recovery mode) 
     52Memory test (memtest86+) 
     53Memory test (memtest86+, serial console 115200) 
     54Windows 7 (loader) (on /dev/sda2) 
     55}}} 
     56 1. NTFSパーティションの削除 
     57  * root@Microknoppix:~# fdisk /dev/sdb 
     58{{{ 
     59 
     60   Device Boot      Start         End      Blocks   Id  System 
     61/dev/sdb1               1          33      262144+  82  Linux swap / Solaris 
     62Partition 1 does not end on cylinder boundary. 
     63/dev/sdb2   *          33        2644    20971520+   7  HPFS/NTFS 
     64/dev/sdb3            2644       14594    95987127+  83  Linux 
     65 
     66Command (m for help): d 
     67Partition number (1-4): 2 
     68 
     69Command (m for help): d 
     70Partition number (1-4): 3 
     71 
     72Command (m for help): n 
     73Command action 
     74   e   extended 
     75   p   primary partition (1-4) 
     76p 
     77Partition number (1-4): 2 
     78First cylinder (33-14593, default 33): 
     79Using default value 33 
     80Last cylinder, +cylinders or +size{K,M,G} (33-14593, default 14593): 
     81Using default value 14593 
     82 
     83Command (m for help): w 
     84}}} 
     85{{{ 
     86   Device Boot      Start         End      Blocks   Id  System 
     87/dev/sdb1              63      524351      262144+  82  Linux swap / Solaris 
     88Partition 1 does not end on cylinder boundary. 
     89/dev/sdb2          524352   234436544   116956096+  83  Linux 
     90}}} 
     91 1. backupしておいたdisk imageからLinuxパーティションを書き戻し 
     92  * root@Microknoppix:~# dd if=/media/sda/bb.sda bs=512 skip=42467393 of=/dev/sdb2 
     93{{{ 
     94191974255+0 records in 
     95191974255+0 records out 
     9698290818560 bytes (98 GB) copied, 3223.76 s, 30.5 MB/s 
     97}}} 
     98 1. 正常には起動しなくなるため、grubから手動でUbuntuを起動する 
     99  * 以下の様に、grub consoleに落ちる 
     100{{{ 
     101grub rescue> set 
     102prefix=(hd0,3)/boot/grub 
     103root=(hd0,3) 
     104}}} 
     105  * [http://d.hatena.ne.jp/syque/20110225/1298618896 Ubuntu で grub rescue -> grub-install を実行して grub を修復 - 新芽の手、ほんとの手] 
     106  * 上記サイトに倣い、以下のようにしてGRUBメニューを起動する 
     107{{{ 
     108set prefix=(hd0,2)/boot/grub 
     109insmod (hd0,2)/boot/grub/normal.mod 
     110normal 
     111}}} 
     112   * これで、以前のGRUB起動メニューが表示される 
     113  * 通常通り起動 
     114 1. grubを修復する 
     115  * sudo grub-install /dev/sda 
     116{{{ 
     117Installation finished. No error reported. 
     118}}} 
     119  * sudo update-grub 
     120{{{ 
     121Generating grub.cfg ... 
     122Found linux image: /boot/vmlinuz-2.6.32-33-generic 
     123Found initrd image: /boot/initrd.img-2.6.32-33-generic 
     124Found linux image: /boot/vmlinuz-2.6.32-32-generic 
     125Found initrd image: /boot/initrd.img-2.6.32-32-generic 
     126Found linux image: /boot/vmlinuz-2.6.32-31-generic 
     127Found initrd image: /boot/initrd.img-2.6.32-31-generic 
     128Found memtest86+ image: /boot/memtest86+.bin 
     129done 
     130}}} 
     131 1. GRUBメニュー修復完了 
     132  * grep menuentry /boot/grub/grub.cfg | tr \" \' | cut -d\' -f2 
     133{{{ 
     134Ubuntu, with Linux 2.6.32-33-generic 
     135Ubuntu, with Linux 2.6.32-33-generic (recovery mode) 
     136Ubuntu, with Linux 2.6.32-32-generic 
     137Ubuntu, with Linux 2.6.32-32-generic (recovery mode) 
     138Ubuntu, with Linux 2.6.32-31-generic 
     139Ubuntu, with Linux 2.6.32-31-generic (recovery mode) 
     140Memory test (memtest86+) 
     141Memory test (memtest86+, serial console 115200) 
     142}}} 
     143 1. 適宜、Filesystemの伸張をする 
     144  * df -h / 
     145{{{ 
     146Filesystem            Size  Used Avail Use% Mounted on 
     147/dev/sda2              93G   33G   56G  37% / 
     148}}} 
     149  * sudo resize2fs /dev/sda2 
     150{{{ 
     151resize2fs 1.41.11 (14-Mar-2010) 
     152Filesystem at /dev/sda2 is mounted on /; on-line resizing required 
     153old desc_blocks = 6, new_desc_blocks = 7 
     154Performing an on-line resize of /dev/sda2 to 29239024 (4k) blocks. 
     155The filesystem on /dev/sda2 is now 29239024 blocks long. 
     156}}} 
     157  * df -h / 
     158{{{ 
     159Filesystem            Size  Used Avail Use% Mounted on 
     160/dev/sda2             110G   33G   72G  32% / 
     161}}}