3

I've set up a file server several months ago using the click-to-deploy method on Google Cloud Launcher (https://cloud.google.com/launcher/docs/single-node-fileserver). This created a ZFS server in a VM and a 500 GB persistent disk.

I have updated the size of the disk using the GUI (to 1 TB). Now I'd like to grow this disk on the file server, but I can't manage to get it working.

Here is my config:

$ sudo lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   10G  0 disk 
└─sda1   8:1    0   10G  0 part /
sdb      8:16   0 1000G  0 disk 
├─sdb1   8:17   0  500G  0 part 
└─sdb9   8:25   0    8M  0 part 

I tried to use resize2fs on both the disk and first partition but it shows an error:

$ sudo resize2fs /dev/sdb
resize2fs 1.42.12 (29-Aug-2014)
resize2fs: Device or resource busy while trying to open /dev/sdb
Couldn't find valid filesystem superblock.

$ sudo resize2fs /dev/sdb1
resize2fs 1.42.12 (29-Aug-2014)
resize2fs: Device or resource busy while trying to open /dev/sdb1
Couldn't find valid filesystem superblock.

The zpool is configured to have an autoexpand=ON and I have tried to reboot the VM several times but it's still not working:

$ sudo zpool list
NAME   SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
data   496G   478G  18.2G         -    72%    96%  1.00x  ONLINE  -

However, when I type fdisk -l it seems that the sdb1 partition is 1000GB:

$ sudo fdisk -l

Disk /dev/sdb: 1000 GiB, 1073741824000 bytes, 2097152000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 07109AC6-344C-4641-95AD-2B14EA1A24F8

Device          Start        End    Sectors  Size Type
/dev/sdb1        2048 2097133567 2097131520 1000G Solaris /usr & Apple ZFS
/dev/sdb9  2097133568 2097149951      16384    8M Solaris reserved 1

Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xac97f178

Device     Boot Start      End  Sectors Size Id Type
/dev/sda1  *     4096 20971519 20967424  10G 83 Linux

Is there anybody that can help me?

(I should add that I am not a professional sysadmin and that took me several hours to get there :/ )

EDIT

The status of zpool:

$ sudo zpool status

  pool: data
 state: ONLINE
  scan: none requested
config:
        NAME        STATE     READ WRITE CKSUM
        data        ONLINE       0     0     0
          sdb       ONLINE       0     0     0

errors: No known data errors
  • Be glad that `resize2fs` didn't work. It would likely have corrupted your *ZFS* file system. What's the output from `zpool status`? – Andrew Henle Mar 28 '17 at 13:04
  • Thanks for the information, getting it from the GCP doc, I had absolutely no idea this command could lead to fs corruption O_o I have edited the answer with the status. `$ sudo zpool status pool: data state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM data ONLINE 0 0 0 sdb ONLINE 0 0 0 errors: No known data errors` – Nicolas Raynaud Mar 28 '17 at 13:13

2 Answers2

2

In order to resize a ZFS zpool, you need to use:

zpool online -e data /dev/sdb

You may have to run partprobe before that.

ewwhite
  • 197,159
  • 92
  • 443
  • 809
  • Amazing! I had already tested the `zpool online` command, but with `partprobe` before it worked! Thanks a lot :) Do you think I can safely add these two commands in the boot sequence so it is reevaluated every time the server restarts? – Nicolas Raynaud Mar 29 '17 at 08:25
  • The `partprobe` is only needed if you're not rebooting. The `zpool online -e` will work after a reboot. I wouldn't do any of this automatically – ewwhite Mar 29 '17 at 12:58
0

Your problem is sdb9:

Device          Start        End    Sectors  Size Type
/dev/sdb1        2048 2097133567 2097131520 1000G Solaris /usr & Apple ZFS
/dev/sdb9  2097133568 2097149951      16384    8M Solaris reserved 1

Notice where sdb1 ends and sdb9 begins. 2097133567 + 1 = 2097133568. There is no space for sdb1 to grow. I'm not sure what sdb9 is. Maybe someone else can suggest what to do with it.

longneck
  • 23,082
  • 4
  • 52
  • 86