From owner-freebsd-questions@freebsd.org Sat Apr 11 08:31:54 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 356122B3642 for ; Sat, 11 Apr 2020 08:31:54 +0000 (UTC) (envelope-from ml@netfence.it) Received: from soth.netfence.it (net-2-44-121-52.cust.vodafonedsl.it [2.44.121.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mailserver.netfence.it", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48zp5P0sRMz4LfF for ; Sat, 11 Apr 2020 08:31:52 +0000 (UTC) (envelope-from ml@netfence.it) Received: from guardian.ventu (guardian.guest.netfence.it [192.168.133.26]) (authenticated bits=0) by soth.netfence.it (8.15.2/8.15.2) with ESMTPSA id 03B8VkWi085282 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Sat, 11 Apr 2020 10:31:46 +0200 (CEST) (envelope-from ml@netfence.it) X-Authentication-Warning: soth.netfence.it: Host guardian.guest.netfence.it [192.168.133.26] claimed to be guardian.ventu Subject: Re: Restoring and snapshots To: David Christensen , freebsd-questions@freebsd.org References: <56b4e678-0e66-e65b-b9d2-a2e79a5b7b6f@netfence.it> From: Andrea Venturoli Message-ID: Date: Sat, 11 Apr 2020 10:31:48 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.83 X-Rspamd-Queue-Id: 48zp5P0sRMz4LfF X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=netfence.it; spf=pass (mx1.freebsd.org: domain of ml@netfence.it designates 2.44.121.52 as permitted sender) smtp.mailfrom=ml@netfence.it X-Spamd-Result: default: False [-4.52 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:2.44.121.52]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[netfence.it,none]; IP_SCORE(-1.72)[ip: (-8.33), ipnet: 2.44.0.0/16(-4.16), asn: 30722(3.84), country: IT(0.03)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:30722, ipnet:2.44.0.0/16, country:IT]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Apr 2020 08:31:54 -0000 On 2020-04-11 01:53, David Christensen wrote: > ZFS can roll back a filesystem per a snapshot.  See zfs(8) 'rollback'. I know, but this is not the point of my question. Probably I've not been that clear: let's suppose I'm restoring data from a ZFS system on a non ZFS filesystem. I just have plain files and I have to deal with that. > The ZFS analog of dump(8) is 'zfs send' and the ZFS analog of restore(8) > ... Again, I know, I'm using that in other situations, but this is not the case. > I am not sure I understand what you mean by "directories which must > overlap" (?). For example, after restore, I have: .../usr/jails/.zfs/snapshot/snapname/dc/ and .../usr/jails/dc/.zfs/snapshot/snapname/ (This is a result of ezjail use of nullfs). So (in my script) I cannot simply "mv" directories around, but sometimes I need to "merge" them. > The numerous shells and languages each have their own idiosyncrasies > when it comes to spaces in file and directory names. While I avoid whitespaces in filenames, my users unfortunately won't (including very creative things, like spaces at the beginning or end). > The key concept is that each path component needs to be preserved as a > single unit, and not broken into pieces if it contains spaces. Ok. The real problem, when writing my script, is that I end up looping over results of `ls ...` or `find ...`. I read that is considered bad practice, so I asked if, maybe, there was a better way. Up to now, it seems not... I'm wondering if I should abandon sh and use something else (Python?). bye & Thanks av.