GNU/Linux >> Linux Esercitazione >  >> Cent OS

Come usare il comando "dispositivo btrfs" per aggiungere/eliminare il dispositivo nel/dal filesystem btrfs

Btrfs è un file system open source per uso generico per Linux. Il nome deriva dall'uso di B-tree per memorizzare le strutture interne del file system. Per il file system vengono utilizzati nomi diversi, inclusi "Butter F S" e "B-tree F S". Lo sviluppo di Btrfs è iniziato in Oracle nel 2007 e ora numerose aziende (tra cui Red Hat, Fujitsu, Intel, SUSE e molte altre) stanno contribuendo allo sforzo di sviluppo. Btrfs è incluso nel kernel Linux principale.

Utilità del dispositivo btrfs

Utilizzare il comando btrfs device per gestire i dispositivi sui file system Btrfs. Un elenco dei comandi disponibili è il seguente:

# btrfs device
usage: btrfs device [command] [args]

    btrfs device add [options] [device] [device...] [path]
        Add a device to a filesystem
    btrfs device delete [device]|[devid] [device|devid...] [path]
    btrfs device remove [device]|[devid] [device|devid...] [path]
        Remove a device from a filesystem
    btrfs device scan [(-d|--all-devices)|[device] [device...]]
        Scan devices for a btrfs filesystem
    btrfs device ready [device]
        Check device to see if it has all of its devices in cache for mounting
    btrfs device stats [options] [path]|[device]
        Show device IO error statistics
    btrfs device usage [options] [path] [path..]
        Show detailed information about internal allocations in devices.

manage and query devices in the filesystem

Il comando btrfs device scan esegue la scansione dei dispositivi fisici alla ricerca di membri di un volume Btrfs. Questo comando consente di montare un file system Btrfs con più dischi senza specificare tutti i dischi nel comando mount.

Non è necessario eseguire "btrfs device scan" dalla riga di comando, perché udev esegue automaticamente btrfs device scan all'avvio. Utilizzare il comando btrfs device add per aggiungere un dispositivo a un file system. In questo esempio, la struttura del file system corrente è la seguente:

# btrfs filesystem show
Label: none  uuid: ba60ac96-1628-4656-b68b-c7327ff49179
	Total devices 1 FS bytes used 325.29MiB
	devid    1 size 10.00GiB used 867.66MiB path /dev/sda

Il comando btrfs filesystem df mostra:

# btrfs filesystem df /btrfs
Data, single: total=547.66MiB, used=324.75MiB
System, single: total=32.00MiB, used=16.00KiB
Metadata, single: total=288.00MiB, used=528.00KiB
GlobalReserve, single: total=16.00MiB, used=0.00B

L'output del comando df mostra:

# df -h /btrfs
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda         10G  342M  9.4G   4% /btrfs

Aggiungi un disco da 10 GB, /dev/sdb, al file system montato su /btrfs usando il comando btrfs device add:

# btrfs device add /dev/sdb /btrfs

L'output del comando btrfs filesystem show mostra il dispositivo appena aggiunto:

# btrfs filesystem show
Label: none  uuid: ba60ac96-1628-4656-b68b-c7327ff49179
	Total devices 2 FS bytes used 325.29MiB
	devid    1 size 10.00GiB used 867.66MiB path /dev/sda
	devid    2 size 10.00GiB used 0.00B path /dev/sdb

L'output del comando btrfs filesystem df non mostra alcuna differenza dopo aver aggiunto il nuovo dispositivo:

# btrfs filesystem df /btrfs
Data, single: total=547.66MiB, used=324.75MiB
System, single: total=32.00MiB, used=16.00KiB
Metadata, single: total=288.00MiB, used=528.00KiB
GlobalReserve, single: total=16.00MiB, used=0.00B

Non vi è alcuna differenza nell'output perché il dispositivo appena aggiunto non è stato ancora allocato né per i dati né per i metadati. La dimensione aggiuntiva si riflette nell'output di df:

# df -h /btrfs
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda         20G  342M   20G   2% /btrfs

Dopo aver aggiunto un dispositivo, si consiglia di eseguire il seguente comando balance sul file system:

# btrfs filesystem balance /btrfs
WARNING:

	Full balance without filters requested. This operation is very
	intense and takes potentially very long. It is recommended to
	use the balance filters to narrow down the balanced data.
	Use 'btrfs balance start --full-balance' option to skip this
	warning. The operation will start in 10 seconds.
	Use Ctrl-C to stop it.
10 9 8 7 6 5 4 3 2 1
Starting balance without any filters.
Done, had to relocate 17 out of 17 chunks

L'esecuzione di questo comando ridistribuisce lo spazio bilanciando i blocchi del file system su tutti i dispositivi. Questo comando recupera anche lo spazio sprecato. Utilizzare il comando btrfs device delete per rimuovere un dispositivo da un file system. Esempio:

# btrfs device delete /dev/sdb /btrfs
Come utilizzare il comando "btrfs scrub" per gestire lo scrubbing sui file system Btrfs
Esempi di comando "btrfs" per creare e gestire file system Btrfs
Come creare e montare file system Btrfs (spiegato con esempi)


Cent OS
  1. Come utilizzare lo strumento di aggiornamento RedHat per aggiornare CentOS da 6.x a CentOS 7?

  2. Come aggiungere o eliminare un utente samba sotto Linux

  3. Come ridimensionare / espandere un volume / file system Btrfs

  4. Come eliminare il disco ASM su un dispositivo multipath in CentOS/RHEL

  5. CentOS / RHEL:come trovare l'UUID di un dispositivo o filesystem

Come eliminare un account FTP da SolidCP?

Come eliminare un sito Web da SolidCP?

Come eliminare un account e-mail da SolidCP?

Come eliminare il dominio di posta da SolidCP?

Come aggiungere una directory virtuale da WebsitePanel 2.1?

Come eliminare un sito Web da WebsitePanel 2.1?