大网数据广告活动
服务器运维问答

ZFS snapshot zd0 block device

· 52CE 我爱测

I'm trying to make use of the ability of zfs snapshots. To explain a little how it's configured on my end: zpool create vol0 mirror /dev/sda /dev/sdb zfs create -o volblocksize=128K -V 15T vol0/pprovol I got my ZFS volumes: NAME …

问题原文

原帖链接 · g00gle · CC BY-SA 3.0

I'm trying to make use of the ability of zfs snapshots. To explain a little how it's configured on my end:

zpool create vol0 mirror /dev/sda /dev/sdb
zfs create -o volblocksize=128K -V 15T vol0/pprovol

I got my ZFS volumes:

NAME           USED  AVAIL  REFER  MOUNTPOINT
vol0          15.0T  16.6T   100K  /vol0
vol0/pprovol  15.0T  31.6T  1.99G  -

And I have a block device on:

Disk /dev/zd0: 15 TiB, 16492674416640 bytes, 32212254720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 131072 bytes
I/O size (minimum/optimal): 131072 bytes / 131072 bytes

I formated it as xfs with: mkfs.xfs /dev/zd0 and mounted it on my mounted point

Now I would like to create snapshots for this zd0 device. So that I could rollback changes made on the xfs filesystem.

Is this possiable? And how can I do this?

It does work for my /vol0 but that isn't what I need. Hope to get some help around here! Thanks.

社区高分解答

原帖链接 · ewwhite · CC BY-SA 3.0

Here's how to manage snapshots on an XFS on top of ZFS setup.
(a disclaimer: there are safer and more intelligent ways to store (ppro) data on ZFS)

  • Take a snapshot.
  • Identify the snapshot.
  • Clone the snapshot.
  • Mount the cloned block device.

When you run the ZFS snapshot, the snapshot will appear in your snapshot lists:

From there, you have to clone the snapshot to make it visible as a block device.

zfs clone vol1/pprovol2@snap_daily-2016-12-23-2359 vol1/recovery

This creates a new zfs filesystem named vol1/recovery, and simultaneously creates a new /dev/zdX device. dmesg | tail will reveal the actual device name. It will likely be /dev/zd16.

This is your clone. If you want to mount it, you just run:

mount -t xfs -o nouuid /dev/zd16 /mountpoint

The nouuid is needed because the cloned device has the name UUID as the original XFS filesystem.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-11-23)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。