Difference between revisions of "Master Boot Record (Italiano)"

From ArchWiki
Jump to: navigation, search
(i18n)
(allign to enlish version and marked for translation, recategorized)
Line 1: Line 1:
[[Category:HOWTOs (Italiano)]]
+
[[Category:Boot process (Italiano)]]
 +
[[Category:Mainboards and BIOS (Italiano)]]
 +
[[Category:System recovery (Italiano)]]
 
{{i18n|Master Boot Record}}
 
{{i18n|Master Boot Record}}
== Introduzione ==
 
  
Può succedere, ad esempio in sistemi dual boot, che il Master Boot Record (''MBR'') venga sovrascritto o cancellato dalla reinstallazione di un altro sistema operativo e che quindi non si riesca più ad avviare il proprio sistema Arch Linux. Si avrà quindi la necessità di ripristinare il MBR allo stato precedente.
+
{{translateme}}
 +
{{Nota|Questo articolo è in fase di traduzione. Seguite per ora le istruzioni della versione inglese.}}
  
Nell'esempio sotto riportato, si assume che Arch Linux (che a seguito della cancellazione del MBR non si riesce più ad avviare) sia stato installato sulla seconda partizione del primo hard disk del computer.
+
{{Article summary start}}
 +
{{Article summary text|An overview of the Master Boot Record; the first sector of a partitioned data storage device.}}
 +
{{Article summary heading|Overview}}
 +
{{Article summary text|{{Boot process overview}}}}
 +
{{Article summary heading|Related}}
 +
{{Article summary wiki|GUID Partition Table}}
 +
{{Article summary wiki|Unified Extensible Firmware Interface}}
 +
{{Article summary wiki|Arch Boot Process}}
 +
{{Article summary end}}
  
== Ripristinare il MBR ==
+
The Master Boot Record (MBR) is the first 512 bytes of a storage device.  The MBR is not a partition; it is reserved for the operating system's bootloader and the storage device's partition table. The MBR may eventually be replaced by the [[GUID Partition Table]], which is part of the [[Unified Extensible Firmware Interface]] specification.
  
Avviare il computer con inserito il CD di installazione di Arch Linux (oppure un qualsiasi live CD Linux in cui sia presente il programma Grub).
+
== Boot process ==
  
Caricato il sistema live, al prompt avviare grub con
+
Booting is a multi-stage process.  Most PCs today initialize system devices with firmware called the [http://en.wikipedia.org/wiki/BIOS BIOS] (Basic Input/Output System), which is typically stored in a dedicated ROM chip on the system board. After system devices have been initialized, the BIOS looks for the bootloader on the MBR of the first recognized storage device (hard disk drive, solid state drive, CD/DVD drive, USB drive...) or the first partition of the device.  It then executes that program. The bootloader reads the partition table, and is then capable of loading the operating system(s). Common GNU/Linux bootloaders include [[GRUB]] and [[LILO]].
  grub
+
  
alla linea di comando di grub, dare i seguenti comandi, sostituendo X e Y con i numeri corretti (come spiegato in seguito) e adatti alla propria configurazione di dischi e partizioni
+
== History ==
root (hdX,Y)
+
  
ad esempio, ''root (hd0,1)'' indica a grub che il file menu.lst (il suo file di configurazione che verrà letto per riscrivere il MBR) risiede (''root'') nel primo hard disk (''hd0''), precisamente nella seconda partizione (''1'') dello stesso disco. Grub comincia a contare i dischi e le partizioni da ''0'' per cui attenzione nel numerare partizione e disco.
+
The MBR consists of a short piece of assembly code (the initial bootloader – 446 bytes), a partition table for the 4 primary partitions (16 bytes each) and a ''sentinel'' (0xAA55).
  
In seguito, per scrivere il MBR, dare il comando
+
The "Conventional" Windows/DOS MBR bootloader code will check the partition table for one and only one ''active'' partition, read X sectors from this partition and then transfer control to the operating system. The Windows/DOS bootloader can ''not'' boot an Arch Linux partition because it is not designed to load the Linux kernel, and it can only cater for an ''active'', ''primary'' partition (which GRUB safely ignores).
  
setup (hdX)
+
The [[GRUB|GRand Unified Bootloader (GRUB)]] is the de facto standard bootloader for GNU/Linux, and users are recommended to install it on the MBR to allow booting from ''any'' partition, whether it be primary or logical.
  
ad esempio, ''setup (hd0)'' indica a grub di scrivere sul MBR del primo (e in molti casi unico) hard disk presente nel computer.
+
== Backup and restoration ==
  
Fatto questo, uscire da grub con
+
Because the MBR is located on the disk it can be backed up and later recovered.
quit
+
  
e riavviare il computer con
+
To backup the MBR:
  reboot
+
 
 +
dd if=/dev/hda of=/path/mbr-backup bs=512 count=1
 +
 
 +
Restore the MBR:
 +
 
 +
dd if=/path/mbr-backup of=/dev/hda bs=512 count=1
 +
 
 +
{{Warning|Restoring the MBR with a mismatching partition table will make your data unreadable and nearly impossible to recover. If you simply need to reinstall the bootloader see [[GRUB]] or [[LILO]].}}
 +
 
 +
To erase the MBR (may be useful if you have to do a full reinstall of another operating system) only the first 446 bits are zeroed because the rest of the data contains the partition table:
 +
 
 +
dd if=/dev/zero of=/dev/hda bs=446 count=1
 +
 
 +
== Restoring a Windows boot record ==
 +
 
 +
Windows by convention (and for ease of installation) is usually installed on the first partition and installs its partition table and reference to its bootloader to the first sector of that partition.  If you accidentally install a bootloader like GRUB to the Windows partition or damage the boot record in some other way, you will need to use a utility to repair it.  Microsoft includes an boot sector fix utility {{Codeline|FIXBOOT}} and MBR fix utility called {{Codeline|FIXMBR}} on their recovery CDs or sometimes the install CD.  Using this method you can fix the reference on the boot sector of the first partition to the bootloader file and fix the reference on the MBR to the first partition respectively.  After doing this you will have to [[GRUB#Bootloader installation|reinstall GRUB]] to the MBR as is intended to in the first place (the GRUB bootloader can be assigned to load the Windows bootloader when defined to).
 +
 
 +
If you wish to revert back to using Windows, you can use the {{Codeline|FIXBOOT}} command which chains from the MBR to the boot sector of the first partition to restore you normal automatic loading of the Windows operating system.
 +
 
 +
Of note, there is a Linux utility called {{Codeline|ms-sys}} (package {{Package AUR|ms-sys}} in AUR) that can install MBR's.  However this utility is only currently capable of writing new MBR's (all OS's and file systems supported) and boot sectors (a.k.a. boot record i.e. equivalent to using {{Codeline|FIXBOOT}}) for FAT file systems.  Most LiveCDs don't have this utility by default so it will need to be installed first, or you can look at a rescue CD that does have it like [http://partedmagic.com/ Parted Magic].
 +
 
 +
First, write the partition info (table) again by:
 +
 
 +
  ms-sys --partition /dev/sda1
 +
 
 +
Next write a Windows 2000/XP/2003 MBR:
 +
 
 +
ms-sys --mbr /dev/sda  # Read options for different versions
 +
 
 +
Then write the new boot sector (boot record)
 +
 
 +
ms-sys -(1-6)          # Read options to discover the correct FAT record type
 +
 
 +
{{Codeline|ms-sys}} can also write Windows 98, ME, Vista, and 7 MBRs as well, see {{Codeline|ms-sys -h}}.
 +
 
 +
== Resources ==
 +
 
 +
* [http://kb.iu.edu/data/aijw.html What is a Master Boot Record (MBR)?]

Revision as of 11:54, 25 September 2011

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Tango-preferences-desktop-locale.pngThis article or section needs to be translated.Tango-preferences-desktop-locale.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Master Boot Record (Italiano)#)
Nota: Questo articolo è in fase di traduzione. Seguite per ora le istruzioni della versione inglese.
Summary help replacing me
An overview of the Master Boot Record; the first sector of a partitioned data storage device.
Overview
Template:Boot process overview
Related
GUID Partition Table
Unified Extensible Firmware Interface
Arch Boot Process

The Master Boot Record (MBR) is the first 512 bytes of a storage device. The MBR is not a partition; it is reserved for the operating system's bootloader and the storage device's partition table. The MBR may eventually be replaced by the GUID Partition Table, which is part of the Unified Extensible Firmware Interface specification.

Boot process

Booting is a multi-stage process. Most PCs today initialize system devices with firmware called the BIOS (Basic Input/Output System), which is typically stored in a dedicated ROM chip on the system board. After system devices have been initialized, the BIOS looks for the bootloader on the MBR of the first recognized storage device (hard disk drive, solid state drive, CD/DVD drive, USB drive...) or the first partition of the device. It then executes that program. The bootloader reads the partition table, and is then capable of loading the operating system(s). Common GNU/Linux bootloaders include GRUB and LILO.

History

The MBR consists of a short piece of assembly code (the initial bootloader – 446 bytes), a partition table for the 4 primary partitions (16 bytes each) and a sentinel (0xAA55).

The "Conventional" Windows/DOS MBR bootloader code will check the partition table for one and only one active partition, read X sectors from this partition and then transfer control to the operating system. The Windows/DOS bootloader can not boot an Arch Linux partition because it is not designed to load the Linux kernel, and it can only cater for an active, primary partition (which GRUB safely ignores).

The GRand Unified Bootloader (GRUB) is the de facto standard bootloader for GNU/Linux, and users are recommended to install it on the MBR to allow booting from any partition, whether it be primary or logical.

Backup and restoration

Because the MBR is located on the disk it can be backed up and later recovered.

To backup the MBR:

dd if=/dev/hda of=/path/mbr-backup bs=512 count=1

Restore the MBR:

dd if=/path/mbr-backup of=/dev/hda bs=512 count=1
Warning: Restoring the MBR with a mismatching partition table will make your data unreadable and nearly impossible to recover. If you simply need to reinstall the bootloader see GRUB or LILO.

To erase the MBR (may be useful if you have to do a full reinstall of another operating system) only the first 446 bits are zeroed because the rest of the data contains the partition table:

dd if=/dev/zero of=/dev/hda bs=446 count=1

Restoring a Windows boot record

Windows by convention (and for ease of installation) is usually installed on the first partition and installs its partition table and reference to its bootloader to the first sector of that partition. If you accidentally install a bootloader like GRUB to the Windows partition or damage the boot record in some other way, you will need to use a utility to repair it. Microsoft includes an boot sector fix utility Template:Codeline and MBR fix utility called Template:Codeline on their recovery CDs or sometimes the install CD. Using this method you can fix the reference on the boot sector of the first partition to the bootloader file and fix the reference on the MBR to the first partition respectively. After doing this you will have to reinstall GRUB to the MBR as is intended to in the first place (the GRUB bootloader can be assigned to load the Windows bootloader when defined to).

If you wish to revert back to using Windows, you can use the Template:Codeline command which chains from the MBR to the boot sector of the first partition to restore you normal automatic loading of the Windows operating system.

Of note, there is a Linux utility called Template:Codeline (package Template:Package AUR in AUR) that can install MBR's. However this utility is only currently capable of writing new MBR's (all OS's and file systems supported) and boot sectors (a.k.a. boot record i.e. equivalent to using Template:Codeline) for FAT file systems. Most LiveCDs don't have this utility by default so it will need to be installed first, or you can look at a rescue CD that does have it like Parted Magic.

First, write the partition info (table) again by:

ms-sys --partition /dev/sda1

Next write a Windows 2000/XP/2003 MBR:

ms-sys --mbr /dev/sda  # Read options for different versions

Then write the new boot sector (boot record)

ms-sys -(1-6)          # Read options to discover the correct FAT record type

Template:Codeline can also write Windows 98, ME, Vista, and 7 MBRs as well, see Template:Codeline.

Resources