public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Don't be like stupid me!
@ 2024-02-10 15:56 Alan Mackenzie
  2024-02-10 16:06 ` Stefan Schmiedl
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alan Mackenzie @ 2024-02-10 15:56 UTC (permalink / raw
  To: gentoo-user

Hello, gentoo.

I was wanting to do a pretty full build of my Emacs working repository.
This involved first purging al *.elc files.  The way to do this is

    $ find . -name '*.elc' | xargs rm

..  But for some reason, I typed

    $ find . '*.elc' | xargs rm

..  I even carefully checked it before pressing RET.  However, press it I
did, instantly deleting all files in my working directory.  OUTCH!

So, I fell back on my backup from last Sunday.  After about 1½ hours
trial and error, I had my source files as of last Sunday back again,
though git could have been more helpful than it actually is.

Thankfully, I had Emacs open, with all the files modified since Sunday
in buffers.  So, I laboriously worked through Emacs's buffer list,
saving those ones I'd since changed.

I lost all my timestamps on the files, and lost all my Emacs backup
files (things ending in ~ which Emacs constantly makes).  But my
software builds and runs.

It could have been a lot worse.  Boys and girls, don't use

    $ find .... | xargs rm

unless you really know what you're doing.  And even then, it's probably
better not to.  ;-(

It occurred to me fairly quickly after that press of RET that I could
have done well with a COW snapshot facility, something which has been
discussed at length on another recent thread.  I even have LVM on my
machine for its RAID capabilities.  But I've never bothered before.  I
mean "I'm too careful", amn't I?  ;-(  At least I do a weekly backup,
though.

So, in the end I managed to recover fairly well, thankfully.

-- 
Alan Mackenzie (Nuremberg, Germany).


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] Don't be like stupid me!
  2024-02-10 15:56 [gentoo-user] Don't be like stupid me! Alan Mackenzie
@ 2024-02-10 16:06 ` Stefan Schmiedl
  2024-02-11  2:14 ` William Kenworthy
  2024-02-11 18:13 ` cal
  2 siblings, 0 replies; 6+ messages in thread
From: Stefan Schmiedl @ 2024-02-10 16:06 UTC (permalink / raw
  To: gentoo-user

------ Original Message ------
From "Alan Mackenzie" <acm@muc.de>
To gentoo-user@lists.gentoo.org
Date 10.02.2024 16:56:25
Subject [gentoo-user] Don't be like stupid me!

>
>It could have been a lot worse.  Boys and girls, don't use
>
>     $ find .... | xargs rm
>
>unless you really know what you're doing.  And even then, it's probably
>better not to.  ;-(
>
That's why I run

$ find ... -print

before

$ find ... -delete

s.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] Don't be like stupid me!
  2024-02-10 15:56 [gentoo-user] Don't be like stupid me! Alan Mackenzie
  2024-02-10 16:06 ` Stefan Schmiedl
@ 2024-02-11  2:14 ` William Kenworthy
  2024-02-11 10:48   ` Alan Mackenzie
  2024-02-12  8:34   ` Björn Fischer
  2024-02-11 18:13 ` cal
  2 siblings, 2 replies; 6+ messages in thread
From: William Kenworthy @ 2024-02-11  2:14 UTC (permalink / raw
  To: gentoo-user


On 10/2/24 23:56, Alan Mackenzie wrote:
> Hello, gentoo.
>
> I was wanting to do a pretty full build of my Emacs working repository.
> This involved first purging al *.elc files.  The way to do this is
>
>      $ find . -name '*.elc' | xargs rm
>
> .  But for some reason, I typed
>
>      $ find . '*.elc' | xargs rm
>
> .  I even carefully checked it before pressing RET.  However, press it I
> did, instantly deleting all files in my working directory.  OUTCH!
>
> So, I fell back on my backup from last Sunday.  After about 1½ hours
> trial and error, I had my source files as of last Sunday back again,
> though git could have been more helpful than it actually is.
>
> Thankfully, I had Emacs open, with all the files modified since Sunday
> in buffers.  So, I laboriously worked through Emacs's buffer list,
> saving those ones I'd since changed.
>
> I lost all my timestamps on the files, and lost all my Emacs backup
> files (things ending in ~ which Emacs constantly makes).  But my
> software builds and runs.
>
> It could have been a lot worse.  Boys and girls, don't use
>
>      $ find .... | xargs rm
>
> unless you really know what you're doing.  And even then, it's probably
> better not to.  ;-(
>
> It occurred to me fairly quickly after that press of RET that I could
> have done well with a COW snapshot facility, something which has been
> discussed at length on another recent thread.  I even have LVM on my
> machine for its RAID capabilities.  But I've never bothered before.  I
> mean "I'm too careful", amn't I?  ;-(  At least I do a weekly backup,
> though.
>
> So, in the end I managed to recover fairly well, thankfully.
>
No, you don't need a snapshot system - you need a proper backup system 
that stores the proper metadata.  When I was experimenting with 
snapshots (btrfs and moosefs) at different times I lost everything a few 
times with filesystem corruption which meant I lost the snapshots too.

Snapshots are NOT safe backups - treat them as a convenient copy ...

BillK




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] Don't be like stupid me!
  2024-02-11  2:14 ` William Kenworthy
@ 2024-02-11 10:48   ` Alan Mackenzie
  2024-02-12  8:34   ` Björn Fischer
  1 sibling, 0 replies; 6+ messages in thread
From: Alan Mackenzie @ 2024-02-11 10:48 UTC (permalink / raw
  To: gentoo-user

Hello, Bill.

On Sun, Feb 11, 2024 at 10:14:49 +0800, William Kenworthy wrote:

> On 10/2/24 23:56, Alan Mackenzie wrote:
> > I was wanting to do a pretty full build of my Emacs working repository.
> > This involved first purging al *.elc files.  The way to do this is

> >      $ find . -name '*.elc' | xargs rm

> > .  But for some reason, I typed

> >      $ find . '*.elc' | xargs rm

> > .  I even carefully checked it before pressing RET.  However, press it I
> > did, instantly deleting all files in my working directory.  OUTCH!

> > So, I fell back on my backup from last Sunday.  After about 1½ hours
> > trial and error, I had my source files as of last Sunday back again,
> > though git could have been more helpful than it actually is.

> > Thankfully, I had Emacs open, with all the files modified since Sunday
> > in buffers.  So, I laboriously worked through Emacs's buffer list,
> > saving those ones I'd since changed.

> > I lost all my timestamps on the files, and lost all my Emacs backup
> > files (things ending in ~ which Emacs constantly makes).  But my
> > software builds and runs.

> > It could have been a lot worse.  Boys and girls, don't use

> >      $ find .... | xargs rm

> > unless you really know what you're doing.  And even then, it's probably
> > better not to.  ;-(

> > It occurred to me fairly quickly after that press of RET that I could
> > have done well with a COW snapshot facility, something which has been
> > discussed at length on another recent thread.  I even have LVM on my
> > machine for its RAID capabilities.  But I've never bothered before.  I
> > mean "I'm too careful", amn't I?  ;-(  At least I do a weekly backup,
> > though.

> > So, in the end I managed to recover fairly well, thankfully.

> No, you don't need a snapshot system - you need a proper backup system 
> that stores the proper metadata.

I remembered after sending my original post that I stored the timestamps
of all the files in a file called timestamps.txt.  So a quick sed script
invocation on this file, and I had my timestamps back again!

> When I was experimenting with snapshots (btrfs and moosefs) at
> different times I lost everything a few times with filesystem
> corruption which meant I lost the snapshots too.

> Snapshots are NOT safe backups - treat them as a convenient copy ...

I was thinking of a snapshot more as an addition to backups, not an
alternative.  Such would have made it easier for me to recover yesterday.

A backup on the same medium as the filesystem isn't a backup at all.
I've never had a disk drive or SSD fail on me yet, but I'm not pushing my
luck.

> BillK

-- 
Alan Mackenzie (Nuremberg, Germany).


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] Don't be like stupid me!
  2024-02-10 15:56 [gentoo-user] Don't be like stupid me! Alan Mackenzie
  2024-02-10 16:06 ` Stefan Schmiedl
  2024-02-11  2:14 ` William Kenworthy
@ 2024-02-11 18:13 ` cal
  2 siblings, 0 replies; 6+ messages in thread
From: cal @ 2024-02-11 18:13 UTC (permalink / raw
  To: gentoo-user

On 2/10/24 07:56, Alan Mackenzie wrote:
> Hello, gentoo.
> 
> I was wanting to do a pretty full build of my Emacs working repository.
> This involved first purging al *.elc files.  The way to do this is
> 
>     $ find . -name '*.elc' | xargs rm
> 
> 
Just as an aside: find supports the `-delete` action already, preferable
to piping to `xargs rm` since it avoids accidents involving unusual
filenames.

Bonus: you can run `find something -print` first to verify what will be
deleted, then swap out `-print` for `-delete`.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-user] Don't be like stupid me!
  2024-02-11  2:14 ` William Kenworthy
  2024-02-11 10:48   ` Alan Mackenzie
@ 2024-02-12  8:34   ` Björn Fischer
  1 sibling, 0 replies; 6+ messages in thread
From: Björn Fischer @ 2024-02-12  8:34 UTC (permalink / raw
  To: gentoo-user

On 2/11/24 03:14:49, William Kenworthy wrote:
[...]
>> It occurred to me fairly quickly after that press of RET that I
>> could have done well with a COW snapshot facility, something which
>> has been discussed at length on another recent thread.  I even have
>> LVM on my machine for its RAID capabilities.  But I've never
>> bothered before.  I mean "I'm too careful", amn't I?  ;-(  At least
>> I do a weekly backup, though.
[...]
> No, you don't need a snapshot system - you need a proper backup
> system that stores the proper metadata.  When I was experimenting
> with snapshots (btrfs and moosefs) at different times I lost
> everything a few times with filesystem corruption which meant I lost
> the snapshots too.
> 
> Snapshots are NOT safe backups - treat them as a convenient copy ...

Snapshots are as reliable as the underlying file system. Here at CeBiTec
we use snapshots on several PB CephFS and ZFS with great success.

And yes, I completely agree with Alan, snapshots would have saved his
day as they provide excellent and cost efficient protection against
pilot errors.

Our users restore lost data from snapshots themselves in seconds, while
it usually takes several hours to restore data from tape. Snapshots
and tape backups complement each other perfectly and both strategies
provide means of protection the other lacks.

Cheers
Björn


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-02-12  8:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-10 15:56 [gentoo-user] Don't be like stupid me! Alan Mackenzie
2024-02-10 16:06 ` Stefan Schmiedl
2024-02-11  2:14 ` William Kenworthy
2024-02-11 10:48   ` Alan Mackenzie
2024-02-12  8:34   ` Björn Fischer
2024-02-11 18:13 ` cal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox