Ajout de disque dur sur FreeNAS avec ZFS
Ajout de disque dur sur FreeNAS avec ZFS
Nous considérons que l'agrandissement d'un pool par un disque non redondant comme dans notre cas est un agrandissement définitif.
Contexte
Soit une machine dont le système d'exploitation est installé sur un système de fichier ZFS, nous allons ajouter un disque dur et étendre son espace de stockage. Il s'agit d'un disque non redondant.
La commande zpool status
donnera :
[dc@vertigo] ~% zpool status
pool: tank
state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(7) for details.
scan: scrub repaired 0 in 0h38m with 0 errors on Thu Oct 8 01:38:51 2015
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
ada0p2 ONLINE 0 0 0
errors: No known data errors
On constate que le pool tank
est bien connecté au vdev ada0p2
.
On branche un disque dur amovible par un câble usb.
La commande dmesg
retourne ;
umass0: <MSC Bulk-Only Transfer> on usbus2
umass0: SCSI over Bulk-Only; quirks = 0x4100
umass0:4:0:-1: Attached to scbus4
da0 at umass-sim0 bus 0 scbus4 target 0 lun 0
da0: <MAXTOR S TM3750330AS > Fixed Direct Access SCSI-2 device
da0: Serial Number 502CFFFFFFFF
da0: 40.000MB/s transfers
da0: 715404MB (1465149168 512 byte sectors: 255H 63S/T 91201C)
da0: quirks=0x2<NO_6_BYTE>
le disque est reconnu comme le vdev da0
Commande d'ajout
La commande zpool add tank da0
permet d'agrandir l'espace de stockage du pool " tank ". Attention cette commande dans le cas d'un disque utilisé comme un
[dc@vertigo] ~% sudo zpool add tank da0
La commande zpool status
retournera alors :
[dc@vertigo] ~% zpool status
pool: tank
state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(7) for details.
scan: scrub repaired 0 in 0h38m with 0 errors on Thu Oct 8 01:38:51 2015
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
ada0p2 ONLINE 0 0 0
da0 ONLINE 0 0 0
errors: No known data errors
Le disque da0
a bien été ajouté au pool "tank". La commande df -H
retourne :
[dc@vertigo] ~% df -H
Filesystem Size Used Avail Capacity Mounted on
tank/ROOT/10.1-RELEASE-p27-up-20151102_084225 757G 14G 742G 2% /
devfs 1.0k 1.0k 0B 100% /dev
procfs 4.1k 4.1k 0B 100% /proc
linprocfs 4.1k 4.1k 0B 100% /compat/linux/proc
tank/tmp 742G 3.4M 742G 0% /tmp
tank/usr/home 744G 1.7G 742G 0% /usr/home
tank/usr/home/admin 742G 21M 742G 0% /usr/home/admin
tank/usr/home/dc 772G 29G 742G 4% /usr/home/dc
tank/usr/home/domenge 742G 26k 742G 0% /usr/home/domenge
tank/usr/home/solr 743G 255M 742G 0% /usr/home/solr
tank/usr/jails 742G 35k 742G 0% /usr/jails
tank/usr/jails/.warden-template-10.1-RELEASE-amd64 743G 196M 742G 0% /usr/jails/.warden-template-10.1-RELEASE-amd64
tank/usr/jails/gabia 743G 227M 742G 0% /usr/jails/gabia
tank/usr/jails/test 742G 3.0M 742G 0% /usr/jails/test
tank/usr/obj 742G 26k 742G 0% /usr/obj
tank/usr/ports 742G 26k 742G 0% /usr/ports
tank/usr/src 742G 26k 742G 0% /usr/src
tank/var/audit 742G 28k 742G 0% /var/audit
tank/var/log 742G 1.7M 742G 0% /var/log
tank/var/tmp 742G 56M 742G 0% /var/tmp
map -hosts 0B 0B 0B 100% /net
/dev/fuse 0B 0B 0B 100% /usr/home/dc/.gvfs
nas 10G 197k 10G 0% /media/nas
zpool -h
création / destruction du pool
create [-fnd] [-o property=value] ...
[-O file-system-property=value] ...
[-m mountpoint] [-R root] <pool> <vdev> ...
destroy [-f] <pool>
ajout / retrait d'un vdev sous certaines conditions
add [-fn] <pool> <vdev> ...
remove <pool> <device> ...
labelclear [-f] <vdev>
supervision
list [-Hpv] [-o property[,...]] [-T d|u] [pool] ... [interval [count]]
iostat [-v] [-T d|u] [pool] ... [interval [count]]
status [-vx] [-T d|u] [pool] ... [interval [count]]
online [-e] <pool> <device> ...
offline [-t] <pool> <device> ...
clear [-nF] <pool> [device]
reopen <pool>
attach [-f] <pool> <device> <new-device>
detach <pool> <device>
replace [-f] <pool> <device> [new-device]
split [-n] [-R altroot] [-o mntopts]
[-o property=value] <pool> <newpool> [<device> ...]
maintenance / vérification
scrub [-s] <pool> ...
déplacement / changement de machine, la commande export <pool>
met le pool disponible pour un déplacement. La commande import
retrouve le pool sur le vdev déplacé, reconstitue le pool et le rend accessible.
import [-d dir] [-D]
import [-d dir | -c cachefile] [-F [-n]] <pool | id>
import [-o mntopts] [-o property=value] ...
[-d dir | -c cachefile] [-D] [-f] [-m] [-N] [-R root] [-F [-n]] -a
import [-o mntopts] [-o property=value] ...
[-d dir | -c cachefile] [-D] [-f] [-m] [-N] [-R root] [-F [-n]]
<pool | id> [newpool]
export [-f] <pool> ...
mise à jour de la version de ZFS
upgrade [-v]
upgrade [-V version] <-a | pool ...>
reguid <pool>
historique des commandes sur le pool (certaines sont automatiques)
history [-il] [<pool>] ...
configuration des options (quotas...) et tuning
get [-Hp] [-o "all" | field[,...]] <"all" | property[,...]> <pool> ...
set <property=value> <pool>