- Modificato
Il comando tune2fs modifica i parametri sintonizzabili su filesystem di tipo ext2, ext3 ed ext4. Con il comando dumpe2fs!
In pratica significa che visualizza le informazioni sui super blocchi e sui gruppi di blocchi per il filesystem sul dispositivo.
Sintassi:
La sintassi base di questo comando è nome + [comando], ad esempio per vedere le informazioni del nostro filesystem:
tune2fs -l /dev/vdb1
Comandi
Ora vediamo i comandi base:
Modifica dei controlli del filesystem:
tune2fs -c 100 -i 2m /dev/sda1
Visualizzare il nome del volume del filesystem:
tune2fs -l /dev/vdb1 | grep volume
Cambiare il nome del volume del filesystem:
$ tune2fs -L Disk_One /dev/vdb1 $ tune2fs -l /dev/vdb1 | grep volume
Visualizzazione degli intervalli di controllo del filesystem e dei conteggi di montaggio:
tune2fs -l /dev/sda1 | grep interval
Disabilita il controllo del filesystem all'avvio:
$ tune2fs -c -1 /dev/sda1 $ tune2fs -i -1 /dev/sda1
Opzioni:
Per i più creativi, vi lascio una serie di opzioni da scrivere come nella sitassi descritta sopra:
-c max-mount-counts
Adjust the number of mounts after which the filesystem will be checked by e2fsck(8).
If max-mount-counts is 0 or -1, the number of times the filesystem is mounted will be
disregarded by e2fsck(8) and the kernel.
-C mount-count
Set the number of times the filesystem has been mounted. If set to a greater value
than the max-mount-counts parameter set by the -c option, e2fsck(8) will check the
filesystem at the next reboot.
-f Force the tune2fs operation to complete even in the face of errors. This option is
useful when removing the has_journal filesystem feature from a filesystem which has an
external journal (or is corrupted such that it appears to have an external journal),
but that external journal is not available.
WARNING: Removing an external journal from a filesystem which was not cleanly unmounted
without first replaying the external journal can result in severe data loss and
filesystem corruption.
-i interval-between-checks[d|m|w]
Adjust the maximal time between two filesystem checks. No postfix or d result in days,
m in months, and w in weeks. A value of zero will disable the time-dependent checking.
It is strongly recommended that either -c (mount-count-dependent) or -i (time-depen-
dent) checking be enabled to force periodic full e2fsck(8) checking of the filesystem.
Failure to do so may lead to filesystem corruption (due to bad disks, cables, memory,
or kernel bugs) going unnoticed, ultimately resulting in data loss or corruption.
-l List the contents of the filesystem superblock, including the current values of the
parameters that can be set via this program.
-L volume-label
Set the volume label of the filesystem. Ext2 filesystem labels can be at most 16 char-
acters long; if volume-label is longer than 16 characters, tune2fs will truncate it and
print a warning. The volume label can be used by mount(8), fsck(8), and /etc/fstab(5)
(and possibly others) by specifying LABEL=volume_label instead of a block special
device name like /dev/hda5.
-m reserved-blocks-percentage
Set the percentage of the filesystem which may only be allocated by privileged pro-
cesses. Reserving some number of filesystem blocks for use by privileged processes is
done to avoid filesystem fragmentation, and to allow system daemons, such as sys-
logd(8), to continue to function correctly after non-privileged processes are prevented
from writing to the filesystem. Normally, the default percentage of reserved blocks is
5%.
-T time-last-checked
Set the time the filesystem was last checked using e2fsck. The time is interpreted
using the current (local) timezone. This can be useful in scripts which use a Logical
Volume Manager to make a consistent snapshot of a filesystem, and then check the
filesystem during off hours to make sure it hasn't been corrupted due to hardware prob-
lems, etc. If the filesystem was clean, then this option can be used to set the last
checked time on the original filesystem. The format of time-last-checked is the inter-
national date format, with an optional time specifier, i.e. YYYYMMDD[HH[MM[SS]]].
The keyword now is also accepted, in which case the last checked time will be set to
the current time.
-U UUID
Set the universally unique identifier (UUID) of the filesystem to UUID. The format of
the UUID is a series of hex digits separated by hyphens, like this:
"c1b9d5a2-f162-11cf-9ece-0020afc76f16". The UUID parameter may also be one of the fol-
lowing:
clear clear the filesystem UUID
random generate a new randomly-generated UUID
time generate a new time-based UUID
The UUID may be used by mount(8), fsck(8), and /etc/fstab(5) (and possibly others) by
specifying UUID=uuid instead of a block special device name like /dev/hda1.
See uuidgen(8) for more information. If the system does not have a good random number
generator such as /dev/random or /dev/urandom, tune2fs will automatically use a time-
based UUID instead of a randomly-generated UUID.