Ext4 (Italiano)

From ArchWiki
Revision as of 01:15, 15 July 2010 by Morbin (Talk | contribs) (Migrating From ext3 to ext4)

Jump to: navigation, search

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:Ext4 (Italiano)#)

Ext4 è l'evoluzione del filesystem Linux più utilizzato, ext3. Per molti versi, ext4 è un miglioramento più consistente di Ext3 rispetto quello che è stato ext3 su ext2. Ext3 implementava la nuova funzionalità del journaling a Ext2, ma Ext4 modifica importanti strutture dati nel filesystem, come quelli destinati a memorizzare i file dei dati. Il risultato è un filesystem con un design migliorato, migliori prestazioni, affidabilità e funzionalità.

Fonte: Ext4 - Linux Kernel Newbies

Creazione di partizioni ext4 "from scratch"

  1. Aggiornare il sistema: Template:Codeline
  2. Formattare la partizione: Template:Codeline (sostituire Template:Codeline con il dispositivo da formattae (es. Template:Codeline))
  3. Montare la partizione
  4. Aggiungere una voce a Template:Filename, usando il filesystem 'type' ext4
Tip: Consultare il mkfs.ext4 man page per ulteriori opzioni; modificare Template:Filename per visualizzare/configurare le opzioni di default.

Migrazione da ext3 a ext4

Ci sono due modi per passare da ext3 a partizioni ext4:

  • mediante il montaggio delle partizioni ext3 come ext4 senza conversione (compatibilità)
  • mediante la conversione da ext3 a ext4 (performance)

Questi due metodi sono descritti di seguito.

Montare partizioni ext3 come ext4 senza convertirle

Fondamento logico

Un compromesso tra convertire completamente a ext4 e rimanere con ext3, è quello di montare le partizioni esistenti ext3 come ext4.

Pro:

  • Compatibilità (il filesystem può continuare ad essere montato come ext3) – Questo permette agli utenti di leggere ancora il filesystem da altre distribuzioni/sistemi operativi senza supporto a ext4 (ad esempio, Windows con i driver ext3)
  • Miglioramento delle prestazioni (anche se non tanto quanto una piena conversione a della partizione a ext4) – Consultare Ext4 - Linux Kernel Newbies per maggiori delucidazioni.

Contro:

  • Meno funzionalità complessive di ext4 utilizzate (solo quelle che non cambiano il formato del disco, quali l'assegnazione e la ripartizione multiblock ritardato)
Note: Fatta eccezione per la relativa novità di ext4 (che può essere vista come un rischio), non vi è grave inconveniente a questa tecnica .

Procedura

  1. Modificare Template:Filename e cambiare il 'type' da ext3 a ext4 per ogni partizione che si desidera montare come ext4.
  2. Rimontare le partizioni in questione.
  3. Fatto.

Convertire partizioni ext3 a ext4

Fondamento logico

Per provare i vantaggi di ext4, deve essere completato un irreversibile processo di conversione.

Pro:

Contro:

  • L'accesso in sola lettura da Windows può essere fornito da Ext2Explore, ma non c'è attualmente nessun driver per la scrittura dei dati.
  • Irreversibile (le partizioni in ext4 non possono essere ripristinate a ext3)

Prerequisiti

Il seguente software è richiesto sul sistema operativo Arch Linux:

Convertendo la propria partizione /boot a ext4:

Note: La patch ext4 è inclusa di default con il pacchetto GRUB di Arch (al momento in cui si sta scrivendo, e questo probabilmente non cambierà). Altrimenti, GRUB2 è richiesto per l'avvio da una partizione ext4.
Warning: Fare il boot da una partizione ext4 non è "ufficialmente" supportato da GRUB, e GRUB2 è ancora in fase di sviluppo. Mentre GRUB è attivo e predefinito, l'opzione "sicura" è fare il boot da una partizione /boot formattata ext2 o ext3 . CONSIDERATEVI AVVISATI!

Se si converte la partizione di root (/) a ext4:

Se si converte la partizione di root (/) a ext4, anche il seguente software è necessario su un CD/USB:

Note: È raccomandabile usare le ultime release di Arch Linux (2009.02). Le immagini di Arch Linux più datate (<= 2008.06) includono versioni di Template:Codeline obsolete, anche se è semplice risolvere con Template:Codeline dall'ambiente live dopo aver configurato la rete. In alternativa, SystemRescueCd >= 1.1.4 include una versione adatta, ed è un CD utile da avere a portata di mano.

Procedure

These instructions were adapted from http://ext4.wiki.kernel.org/index.php/Ext4_Howto and http://bbs.archlinux.org/viewtopic.php?id=61602. They have been tested and confirmed by this author as of January 16, 2009.

  • UPGRADE! Perform a sysupgrade to ensure all required packages are up-to-date: Template:Codeline
  • BACK-UP! Back-up all data on any ext3 partitions that are to be converted to ext4. Although ext4 is considered 'stable' for general use, it is still a relatively young and untested file system. Furthermore, this conversion process was only tested on a relatively simple setup; it is impossible to test each of the many possible configurations the user may be running.
  • Edit Template:Filename and change the 'type' from ext3 to ext4 for any partitions that are to be converted to ext4.
Warning: ext4 is backwards-compatible with ext3 until extents and other new fancy options are enabled. If the user has a partition that is shared with another OS that cannot yet read ext4 partitions, it is possible to mount said partition as ext4 in Arch and still be able to use it as ext3 elsewhere at this point... Not so after the next step! Note, however, that there are fewer benefits to using ext4 if the partition is not fully converted.
  • The conversion process with Template:Codeline must be done when the drive is not mounted. If converting one's root (/) partition, the simplest way to achieve this is to boot from some other live medium, as described in the 'Prerequisites' section above.
Note: The user MUST fsck the filesystem, or it will be unreadable! This fsck run is needed to return the filesystem to a consistent state. It WILL find checksum errors in the group descriptors -- this is expected. The '-f' parameter asks fsck to force checking even if the file system seems clean. The '-p' parameter asks fsck to 'automatically repair' (otherwise, the user will be asked for input for each error). You may need to run fsck -f rather than fsck -fp.
  • Reboot Arch Linux!
Warning: If the user converted their root (/) partition, a kernel panic may be encountered when attempting to boot. If this happens, simply reboot using the 'fallback' initial ramdisk and re-create the 'default' initial ramdisk: Template:Codeline

Migrating files to extents

Even though the filesystem is now converted to ext4, all files that have been written before the conversion do not yet take advantage of the new extents of ext4, which will improve large file performance and reduce fragmentation and filesystem check time. In order to fully take advantage of ext4, all files would have to be rewritten on disk. A utility called e4defrag is being developed and will take care of this task ; however, it is not yet ready for production.

Fortunately, it is possible to use the chattr program, which will cause the kernel to rewrite the file using extents. It is possible to run this command on all files and directories of one partition (e.g. if /home is on a dedicated partition):

find /home -xdev -type f -print0 | xargs -0 chattr +e
find /home -xdev -type d -print0 | xargs -0 chattr +e

It is recommended to test this command on a small number of files first, and check if everything is going all right. It may also be useful to check the filesystem after conversion.

Using the lsattr command, it is possible to check that files are now using extents. The letter 'e' should appear in the attribute list of the listed files.

Troubleshooting

Kernel Panic

One problem this author encountered was a kernel panic after converting the root (/) partition to ext4. This is because the initial ramdisk was detecting the partition as 'ext4dev', rather than 'ext4'. It was a simple matter to boot with the 'fallback' initial ramdisk and re-create the 'default' initial ramdisk :

  • Remount the root partition in read-write mode; assuming 'XXX' is your root partition :
# mount /dev/XXX / -o remount,rw
  • Manually mount the boot partition on /boot if it is on a separate partition.
  • Re-create the ramdisk :
# mkinitcpio -p kernel26

During the creation process, Template:Codeline correctly detected and included ext4 modules in the initial ramdisk.

GRUB Error 13

After a recent kernel update, this author encountered a GRUB error while attempting to boot from an ext4 /boot partition:

Error 13: Invalid or unsupported executable format

The solution is to boot from the live medium and chroot into the Arch Linux installation:

# mkdir /mnt/arch
# mount -t ext4 /dev/sda1 /mnt/arch
# mount -t proc proc /mnt/arch/proc
# mount -t sysfs sys /mnt/arch/sys
# mount -o bind /dev /mnt/arch/dev
# chroot /mnt/arch /bin/bash

If /boot is on a separate partition, this partition must also be mounted:

# mount -t ext4 /dev/sda2 /boot

Then, the following command should resolve the issue. (Does anyone know why?):

# grub-install --recheck /dev/sda

Data Corruption

Some early adopters of ext4 encountered data corruption after a hard reboot. Please read Ext4 data loss; explanations and workarounds for more information.

Since kernel 2.6.30, ext4 is considered "safe(er)." Several patches improved the robustness of ext4 - albeit at a slight performance cost. A new mount option (Template:Codeline) can be used to disable this behavior. For more information, please read Linux 2 6 30 - Filesystems performance improvements.

For kernel versions earlier than 2.6.30, consider adding Template:Codeline to the Template:Codeline line in GRUB's Template:Filename as a preventative measure.

Improving performance

Since kernel 2.6.30, ext4 performance has decreased due to changes that serve to improve data integrity.[1] Users can improve performance with the Template:Codeline option when mounting the disk, but this can be dangerous and may result in data loss or corruption after power failures. To turn barriers off, add the option Template:Codeline to the desired filesystem in Template:Filename. For example:

# /dev/sda5    /    ext4    noatime,barrier=0    0    1