xv4_de

ZFS

Platte vergrößern

von 14G auf 40G

# zfs list zroot
NAME    USED  AVAIL  REFER  MOUNTPOINT
zroot  2,52G  13,9G    96K  /zroot

# zpool set autoexpand=on zroot

# zpool get autoexpand zroot
NAME   PROPERTY    VALUE   SOURCE
zroot  autoexpand  on      local

# gpart show
=>      40  80002992  da0  GPT  (38G)
        40      1024    1  freebsd-boot  (512K)
      1064       984       - free -  (492K)
      2048   4194304    2  freebsd-swap  (2.0G)
   4196352  35803136    3  freebsd-zfs  (17G)
  39999488  40003544       - free -  (19G)

# gpart resize -i 3 da0
da0p3 resized

# gpart show
=>      40  80002992  da0  GPT  (38G)
        40      1024    1  freebsd-boot  (512K)
      1064       984       - free -  (492K)
      2048   4194304    2  freebsd-swap  (2.0G)
   4196352  75806680    3  freebsd-zfs  (36G)

# df -h
Filesystem            Size    Used   Avail Capacity  Mounted on
zroot/ROOT/default     15G    1,4G     14G     9%    /
devfs                 1,0K    1,0K      0B   100%    /dev
zroot/tmp              14G    1,9M     14G     0%    /tmp
zroot/usr/home         14G     96K     14G     0%    /usr/home
zroot/usr/ports        15G    1,1G     14G     7%    /usr/ports
zroot/usr/src          14G     96K     14G     0%    /usr/src
zroot/var/audit        14G     96K     14G     0%    /var/audit
zroot/var/crash        14G     96K     14G     0%    /var/crash
zroot/var/log          14G    328K     14G     0%    /var/log
zroot/var/mail         14G    120K     14G     0%    /var/mail
zroot/var/tmp          14G     96K     14G     0%    /var/tmp
zroot                  14G     96K     14G     0%    /zroot

# zpool list
NAME    SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
zroot    17G  2,52G  14,5G         -    12%    14%  1.00x  ONLINE  -

# zpool online -e zroot da0p3

# zpool list
NAME    SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
zroot  36,1G  2,52G  33,6G         -     5%     6%  1.00x  ONLINE  -

# df -h
Filesystem            Size    Used   Avail Capacity  Mounted on
zroot/ROOT/default     34G    1,4G     32G     4%    /
devfs                 1,0K    1,0K      0B   100%    /dev
zroot/tmp              32G    1,9M     32G     0%    /tmp
zroot/usr/home         32G     96K     32G     0%    /usr/home
zroot/usr/ports        34G    1,1G     32G     3%    /usr/ports
zroot/usr/src          32G     96K     32G     0%    /usr/src
zroot/var/audit        32G     96K     32G     0%    /var/audit
zroot/var/crash        32G     96K     32G     0%    /var/crash
zroot/var/log          32G    328K     32G     0%    /var/log
zroot/var/mail         32G    120K     32G     0%    /var/mail
zroot/var/tmp          32G     96K     32G     0%    /var/tmp
zroot                  32G     96K     32G     0%    /zroot

Fehler beim Vergößern von 40G auf 80G

# gpart show
=>      40  80002992  da0  GPT  (76G) [CORRUPT]
        40      1024    1  freebsd-boot  (512K)
      1064       984       - free -  (492K)
      2048   4194304    2  freebsd-swap  (2.0G)
   4196352  75806680    3  freebsd-zfs  (36G)


# zfs list zroot
NAME    USED  AVAIL  REFER  MOUNTPOINT
zroot  28,5G  6,52G    96K  /zroot  

# gpart resize -i 3 da0
gpart: table 'da0' is corrupt: Operation not permitted

Fehler beheben

# gpart list
Geom name: da0
modified: false
state: CORRUPT
fwheads: 255
fwsectors: 63
last: 80003031
first: 40
entries: 152
scheme: GPT
Providers:
1. Name: da0p1
   Mediasize: 524288 (512K)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r0w0e0
   rawuuid: 2b5dffb7-4d16-11e8-9048-e11bed020ed9
   rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f
   label: gptboot0
   length: 524288
   offset: 20480
   type: freebsd-boot
   index: 1
   end: 1063
   start: 40
2. Name: da0p2
   Mediasize: 2147483648 (2.0G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e0
   rawuuid: 2bb2955a-4d16-11e8-9048-e11bed020ed9
   rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
   label: swap0
   length: 2147483648
   offset: 1048576
   type: freebsd-swap
   index: 2
   end: 4196351
   start: 2048
3. Name: da0p3
   Mediasize: 38813020160 (36G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   rawuuid: 2bb88aa5-4d16-11e8-9048-e11bed020ed9
   rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
   label: zfs0
   length: 38813020160
   offset: 2148532224
   type: freebsd-zfs
   index: 3
   end: 80003031
   start: 4196352
Consumers:
1. Name: da0
   Mediasize: 81923145728 (76G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r2w2e3

# zpool status
  pool: zroot
     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: none requested
config:

    NAME        STATE     READ WRITE CKSUM
    zroot       ONLINE       0     0     0
      da0p3     ONLINE       0     0     0

errors: No known data errors


# gpart recover /dev/da0
da0 recovered

# reboot

nach dem reboot sieht das so aus

# gpart show
=>       40  160006064  da0  GPT  (76G)
         40       1024    1  freebsd-boot  (512K)
       1064        984       - free -  (492K)
       2048    4194304    2  freebsd-swap  (2.0G)
    4196352   75806680    3  freebsd-zfs  (36G)
   80003032   80003072       - free -  (38G)

# gpart resize -i 3 da0
da0p3 resized

# zpool online -e zroot da0p3

# df -h
Filesystem            Size    Used   Avail Capacity  Mounted on
zroot/ROOT/default     71G     27G     43G    39%    /
devfs                 1,0K    1,0K      0B   100%    /dev
zroot/tmp              43G    1,9M     43G     0%    /tmp
zroot/usr/home         43G     96K     43G     0%    /usr/home
zroot/usr/ports        45G    1,1G     43G     2%    /usr/ports
zroot/usr/src          43G     96K     43G     0%    /usr/src
zroot/var/audit        43G     96K     43G     0%    /var/audit
zroot/var/crash        43G     96K     43G     0%    /var/crash
zroot/var/log          43G    360K     43G     0%    /var/log
zroot/var/mail         43G    120K     43G     0%    /var/mail
zroot/var/tmp          43G     96K     43G     0%    /var/tmp
zroot                  43G     96K     43G     0%    /zroot

fertig :)