Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #195443

Re: Backup problem using "cp"

From Kushal Kumaran <kushal@locationd.net>
Newsgroups linux.debian.user
Subject Re: Backup problem using "cp"
Date 2018-05-07 19:20 +0200
Message-ID <vMRXQ-487-13@gated-at.bofh.it> (permalink)
References <vMMEP-BP-51@gated-at.bofh.it> <vMN7R-11n-31@gated-at.bofh.it> <vMO3U-1Cc-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Richard Owlett <rowlett@cloud85.net> writes:

> On 05/07/2018 07:01 AM, Thomas Schmitt wrote:
>> Hi,
>>
>> Richard Owlett wrote:
>>> richard@debian-jan13:~$ stat / | fgrep Device
>>> Device: 80eh/2062d      Inode: 2           Links: 22
>>> richard@debian-jan13:~$ stat /media | fgrep Device
>>> Device: 80eh/2062d      Inode: 131073      Links: 5
>>
>> "/media" was not the directory to examine.
>> You need to examine the directory which you gave as second argument to cp.
>> In your initial post of this thread the cp command is quoted as
>>
>>    cp -ax /  "/media/richard/MISC
>>    backups/dev_sda14/"
>>
>> (Dunno whether the line break in that mail is significant.)
>
> No the _apparent_ line break was an artifact of email quoting process.
> I can't rerun the diagnostic at the moment - hardware fully occupied
> with testing my proposed workaround, which works so far but progress
> resembles molasses running uphill on Pluto in winter ;/
>
>
>>
>>
>>> I gather that "cp" is then an inappropriate tool.
>>
>> That's not decided yet.
>>
>> If your cp target directory had a different device number, then cp option -x
>> did not what it is supposed to do.
>>
>> But if your target directory was not the mount point of the USB disk and
>> not inside the filesystem of the USB disk, then you made a mistake by
>> giving that directory as target.
>
> Understood.
>
>>
>>
>>> "tar" is inappropriate for my preferences - I was attempting to use "cp" as
>>> there would be multiple files &/or directories as input *and* output.
>>
>> You could use multiple tar commands.
>> (I doubt that you can talk cp into addressing more than one target.)
>
> Communication confusion.
> My goal was to copy root and its sub-directory to a directory on
> another physical device.
>

Are you using an LVM volume as your root?  Then mounting a snapshot at
some location and copying from there is a good option.  This is what I
do for my own backups.

If you're not using LVM volumes, you could still use bind mounts for
this.  Run:

  # mkdir -p /mnt/source
  # mount --bind -o ro / /mnt/source

(The -o ro option is to make the /mnt/source mount read only.  I
understand you intend to use this as a backup source, so read-only
access should be sufficient.  If you change it to not be read-only, be
cautious when changing things in /mnt/source, because it is the same
filesystem as /)

Now /mnt/source is exactly the root filesystem.  Other filesystems
mounted (such as /dev or /proc) would only be present as empty
directories in /mnt/source.  After you're done copying, remove the bind
by running:

  # umount /mnt/source

This way, you do not have to figure out an exclude list or instruct
tools to stop at filesystem boundaries.

Make sure you do verify the files and directories you need are included.
If some of the required files are not part of the root filesystem, then
bind-mount them at the proper location under /mnt/source as well.  For
example, if your /home is a different filesystem, and you need it to be
part of your copying:

  # mkdir -p /mnt/source
  # mount --bind -o ro / /mnt/source
  # mount --bind -o ro /home /mnt/source/home

Then unmounting after you finish copying will be in the reverse order:

  # umount /mnt/source/home
  # umount /mnt/source

-- 
regards,
kushal

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Backup problem using "cp" Richard Owlett <rowlett@cloud85.net> - 2018-05-06 16:30 +0200
  Re: Backup problem using "cp" "Thomas Schmitt" <scdbackup@gmx.net> - 2018-05-06 16:40 +0200
    Re: Backup problem using "cp" Richard Owlett <rowlett@cloud85.net> - 2018-05-06 16:50 +0200
      Re: Backup problem using "cp" "Thomas Schmitt" <scdbackup@gmx.net> - 2018-05-06 17:20 +0200
        Re: Backup problem using "cp" Cindy-Sue Causey <butterflybytes@gmail.com> - 2018-05-06 17:30 +0200
        Re: Backup problem using "cp" Richard Owlett <rowlett@cloud85.net> - 2018-05-07 13:40 +0200
          Re: Backup problem using "cp" "Thomas Schmitt" <scdbackup@gmx.net> - 2018-05-07 14:10 +0200
            Re: Backup problem using "cp" Richard Owlett <rowlett@cloud85.net> - 2018-05-07 15:10 +0200
              Re: Backup problem using "cp" "Thomas Schmitt" <scdbackup@gmx.net> - 2018-05-07 15:30 +0200
                Re: Backup problem using "cp" Bob Weber <bobrweber@gmail.com> - 2018-05-07 16:00 +0200
                Re: Backup problem using "cp" Dan Norton <dnorton@mindspring.com> - 2018-05-07 16:50 +0200
                Re: Backup problem using "cp" Richard Owlett <rowlett@cloud85.net> - 2018-05-07 16:10 +0200
                Re: Backup problem using "cp" David Wright <deblis@lionunicorn.co.uk> - 2018-05-08 03:10 +0200
              Re: Backup problem using "cp" Kushal Kumaran <kushal@locationd.net> - 2018-05-07 19:20 +0200
                Re: Backup problem using "cp" Jude DaShiell <jdashiel@panix.com> - 2018-05-07 20:00 +0200
            Running of rrequested tests - [was Re: Backup problem using "cp"] Richard Owlett <rowlett@cloud85.net> - 2018-05-08 17:20 +0200
              Re: Running of rrequested tests - [was Backup problem using "cp"] "Thomas Schmitt" <scdbackup@gmx.net> - 2018-05-08 17:50 +0200
                Re: Running of rrequested tests - [was Backup problem using "cp"] Richard Owlett <rowlett@cloud85.net> - 2018-05-08 19:40 +0200
                Re: Running of rrequested tests - [was Backup problem using "cp"] "Thomas Schmitt" <scdbackup@gmx.net> - 2018-05-08 22:30 +0200
                Re: Running of rrequested tests - [was Backup problem using "cp"] Richard Owlett <rowlett@cloud85.net> - 2018-05-09 14:00 +0200
                Re: Running of rrequested tests - [was Backup problem using "cp"] "Thomas Schmitt" <scdbackup@gmx.net> - 2018-05-09 15:00 +0200
              Re: Running of rrequested tests - [was Re: Backup problem using "cp"] The Wanderer <wanderer@fastmail.fm> - 2018-05-08 17:50 +0200
                Re: Running of rrequested tests - [was Re: Backup problem using "cp"] Richard Owlett <rowlett@cloud85.net> - 2018-05-08 19:50 +0200
                Re: Running of rrequested tests - [was Re: Backup problem using "cp"] The Wanderer <wanderer@fastmail.fm> - 2018-05-09 04:50 +0200
                Re: Running of rrequested tests - [was Re: Backup problem using "cp"] Richard Owlett <rowlett@cloud85.net> - 2018-05-09 14:30 +0200
                Re: Running of rrequested tests - [was Re: Backup problem using "cp"] The Wanderer <wanderer@fastmail.fm> - 2018-05-09 14:50 +0200
                Re: Running of rrequested tests - [was Re: Backup problem using "cp"] Richard Hector <richard@walnut.gen.nz> - 2018-05-09 15:00 +0200
                Re: Running of rrequested tests - [was Re: Backup problem using "cp"] David Wright <deblis@lionunicorn.co.uk> - 2018-05-09 22:30 +0200
                Re: Running of rrequested tests - [was Re: Backup problem using "cp"] Greg Wooledge <wooledg@eeg.ccf.org> - 2018-05-09 22:40 +0200
                Re: Running of rrequested tests - [was Re: Backup problem using "cp"] David Wright <deblis@lionunicorn.co.uk> - 2018-05-10 16:00 +0200
                Re: Running of rrequested tests - [was Re: Backup problem using "cp"] The Wanderer <wanderer@fastmail.fm> - 2018-05-10 05:00 +0200
                Re: Running of rrequested tests - [was Re: Backup problem using "cp"] David Wright <deblis@lionunicorn.co.uk> - 2018-05-10 16:20 +0200
                Re: Running of rrequested tests - [was Re: Backup problem using "cp"] David Wright <deblis@lionunicorn.co.uk> - 2018-05-08 21:50 +0200
          Re: Backup problem using "cp" Dan Purgert <dan@djph.net> - 2018-05-07 14:10 +0200
            Re: Backup problem using "cp" Richard Owlett <rowlett@cloud85.net> - 2018-05-07 15:00 +0200
              Re: Backup problem using "cp" Dan Purgert <dan@djph.net> - 2018-05-07 15:20 +0200
              Re: Backup problem using "cp" Andy Smith <andy@strugglers.net> - 2018-05-07 15:30 +0200
                Re: Backup problem using "cp" "Thomas Schmitt" <scdbackup@gmx.net> - 2018-05-07 16:00 +0200
                Re: Backup problem using "cp" Richard Owlett <rowlett@cloud85.net> - 2018-05-07 16:20 +0200
                Re: Backup problem using "cp" David Wright <deblis@lionunicorn.co.uk> - 2018-05-08 03:20 +0200
                Re: Backup problem using "cp" Richard Owlett <rowlett@cloud85.net> - 2018-05-07 16:10 +0200
          Re: Backup problem using "cp" David Griffith <dave@661.org> - 2018-05-07 15:00 +0200
            Re: Backup problem using "cp" Richard Owlett <rowlett@cloud85.net> - 2018-05-07 15:50 +0200
            Re: Backup problem using "cp" Richard Hector <richard@walnut.gen.nz> - 2018-05-07 16:00 +0200
              Re: Backup problem using "cp" Richard Owlett <rowlett@cloud85.net> - 2018-05-07 16:40 +0200
          Re: Backup problem using "cp" Charlie Gibbs <cgibbs@surfnaked.ca> - 2018-05-07 20:30 +0200
          Re: Backup problem using "cp" David Wright <deblis@lionunicorn.co.uk> - 2018-05-08 03:00 +0200
  Re: Backup problem using "cp" Dan Purgert <dan@djph.net> - 2018-05-06 16:50 +0200
  Re: Backup problem using "cp" Pascal Hambourg <pascal@plouf.fr.eu.org> - 2018-05-06 17:40 +0200
    Re: Backup problem using "cp" Richard Owlett <rowlett@cloud85.net> - 2018-05-06 21:00 +0200
      Re: Backup problem using "cp" David Wright <deblis@lionunicorn.co.uk> - 2018-05-07 00:00 +0200
      Re: Backup problem using "cp" Jonathan Dowland <jmtd@debian.org> - 2018-05-10 10:30 +0200
        Re: Running of rrequested tests - [was Backup problem using "cp"] "Thomas Schmitt" <scdbackup@gmx.net> - 2018-05-10 11:30 +0200
        Re: Backup problem using "cp" David Wright <deblis@lionunicorn.co.uk> - 2018-05-10 15:40 +0200
  SUCCESS!!!! - was {Re: Backup problem using "cp"} Richard Owlett <rowlett@cloud85.net> - 2018-05-11 15:10 +0200
    Re: SUCCESS!!!! - was {Re: Backup problem using "cp"} <tomas@tuxteam.de> - 2018-05-11 15:20 +0200
      Re: SUCCESS!!!! - was {Re: Backup problem using "cp"} Richard Owlett <rowlett@cloud85.net> - 2018-05-11 15:30 +0200
        Re: SUCCESS!!!! - was {Re: Backup problem using "cp"} <tomas@tuxteam.de> - 2018-05-11 17:30 +0200
        Re: SUCCESS!!!! - was {Re: Backup problem using "cp"} Curt <curty@free.fr> - 2018-05-11 17:40 +0200
          Re: SUCCESS!!!! - was {Re: Backup problem using "cp"} Richard Owlett <rowlett@cloud85.net> - 2018-05-11 19:30 +0200
          Re: SUCCESS!!!! - was {Re: Backup problem using "cp"} Gene Heskett <gheskett@shentel.net> - 2018-05-11 19:50 +0200
            Re: SUCCESS!!!! - was {Re: Backup problem using "cp"} Richard Owlett <rowlett@cloud85.net> - 2018-05-11 22:30 +0200
    Re: SUCCESS!!!! - was {Re: Backup problem using "cp"} Pascal Hambourg <pascal@plouf.fr.eu.org> - 2018-05-11 16:50 +0200
      Re: SUCCESS!!!! - was {Re: Backup problem using "cp"} Richard Owlett <rowlett@cloud85.net> - 2018-05-11 20:00 +0200
        Re: SUCCESS!!!! - was {Re: Backup problem using "cp"} Pascal Hambourg <pascal@plouf.fr.eu.org> - 2018-05-11 21:50 +0200
          Re: SUCCESS!!!! - was {Re: Backup problem using "cp"} Richard Owlett <rowlett@cloud85.net> - 2018-05-11 22:40 +0200
    Re: SUCCESS!!!! - was {Re: Backup problem using "cp"} David Wright <deblis@lionunicorn.co.uk> - 2018-05-11 17:30 +0200

csiph-web