FYI: Didn't find a quick solution, so I did a find command executing ls and
saving to a file, just to have it. The more I looked, things were not all
"best" as programs and file systems changed over the years.

So, I'm largely done doing recursive chown, and find executing chmods.

---Paul.

On Sun, May 28, 2023, 5:01 PM Dan Bacus <dbacu...@gmail.com> wrote:

> Something else I'd like to add since the discussion moved this way a bit...
>
> If you use the cp -rp command for a recursive copy, the owner and group
> are not preserved as they are set on the target side to the user who is
> doing the copy.  Also, mtime is set to "now" on the target side.
>
> However, if you want to preserve owner, group, perms, and mtime on a copy
> you can do the following as root:
>
> cd /source
> find . -depth -print | cpio -pdm /target
>
> 1) You must hand cpio the filenames to be copied using a relative path (.)
> 2) For decades find did not have a default action of -print, so I still
> put it there out of habit.
> 3) You need -depth so that find starts at the bottom of the filesystem
> tree and works its way back up.  This makes it so that cpio will set mtimes
> on the directories back to what they had in /source
> 4) The -p option on cpio is pass-through.  It does not build a
> backup/archive file, it does a copy.  The -d option is to make
> sub-directories as needed, and -m maintains mtimes from source to target.
>
> I used this a lot when moving directories in / into their own new
> filesystems after a system had been installed, say /opt, again as root:
>
> mount /dev/whatever /mnt
> cd /opt
> find . -depth -print | cpio -pdm /mnt
> cd /
> du -sk /opt  /mnt             <==  /mnt should be slightly larger than
> /opt due to the /mnt/lost+found directory that was not in /opt since it is
> a part of /
> rm -rf /opt/*                     <== remove everything inside of /opt to
> free up space in the / filesystem, but leave /opt the directory for the
> mount point
> umount /mnt
> mount /dev/whatever /opt
> vi /etc/fstab                    <== or /etc/vfstab, or /etc/filesystem
> depending upon OS; and add an entry to mount /opt at boot time.
>
> Dan
>
> On Sun, May 28, 2023 at 9:25 AM Paul Boniol <paul.bon...@gmail.com> wrote:
>
>> P.S. If you're willing to ignore matching mtime, there is a --size-only
>> parameter.
>>
>> On Sun, May 28, 2023, 9:17 AM Paul Boniol <paul.bon...@gmail.com> wrote:
>>
>>> Funny you should mention rsync. That's what I'm using to copy recent
>>> files.
>>>
>>> You have to run root (sudo) to so some things (like preserve
>>> user/group/mtime). And in my case, to not get nagged about not being able
>>> to change user/group it needs user map and group map parameters. (Shouldn't
>>> be necessary going to ext4.)
>>>
>>> What I ended up choosing was
>>> sudo rsync -avc --usermap=*:paul --groupmap=*:paul source-dir dest-dir
>>>
>>> Obviously do n for trial run till you're sure.
>>>
>>> The checksum option obviously takes quite a while for it to start, but
>>> not choosing checksum, rsync wanted to copy every file, regardless. I'm
>>> guessing some difference in mtime storage? Idk. The user and group mapping
>>> were the last thing I set so possible it was something with that.
>>>
>>> ---Paul.
>>>
>>> On Sun, May 28, 2023, 7:56 AM Howard White <hwh...@vcch.com> wrote:
>>>
>>>> I have struggled with a similar problem.  I have directories of mp3
>>>> files in two places: ntfs and ext4.  With the demise of iROCK109, I
>>>> need
>>>> to resolve all of the ntfs files as the master copied to the ext4 (on
>>>> my
>>>> NAS) which I share in the house.  rsync is messing with me over
>>>> permissions.
>>>>
>>>> Howard
>>>>
>>>> On 5/28/23 03:21, Paul Boniol wrote:
>>>> > Way back, I should have paid more attention... but I have like 3 TB
>>>> of
>>>> > video recordings backed up to an external (exfat) hard drive (should
>>>> > have reformatted as ext4 first but I didn't think about it first).
>>>> >
>>>> > Now I'm preparing to do a fresh Linux install. And I'm wanting to
>>>> > somehow backup the user/group/permissions for the directories and
>>>> files.
>>>> >
>>>> > I can look and write them down as most would be the same. Just
>>>> wondering
>>>> > if there's some better way.
>>>> >
>>>> > ---Paul.
>>>> >
>>>> > --
>>>> > --
>>>>
>>>> --
>> --
>> You received this message because you are subscribed to the Google Groups
>> "NLUG" group.
>> To post to this group, send email to nlug-talk@googlegroups.com
>> To unsubscribe from this group, send email to
>> nlug-talk+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/nlug-talk?hl=en
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "NLUG" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to nlug-talk+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/nlug-talk/CAL9PgS1x3tG5%3DwBYi0%2BAg88mVXVX3q9pzb-Czyqw0SATBxU7gQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/nlug-talk/CAL9PgS1x3tG5%3DwBYi0%2BAg88mVXVX3q9pzb-Czyqw0SATBxU7gQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> --
> You received this message because you are subscribed to the Google Groups
> "NLUG" group.
> To post to this group, send email to nlug-talk@googlegroups.com
> To unsubscribe from this group, send email to
> nlug-talk+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nlug-talk?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "NLUG" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nlug-talk+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nlug-talk/CAEH-QC_jAFdk8bNDAi9i7hw6yChbgM_C5GSoCcg5BqDayuw5MQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/nlug-talk/CAEH-QC_jAFdk8bNDAi9i7hw6yChbgM_C5GSoCcg5BqDayuw5MQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- 
You received this message because you are subscribed to the Google Groups 
"NLUG" group.
To post to this group, send email to nlug-talk@googlegroups.com
To unsubscribe from this group, send email to 
nlug-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nlug-talk?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"NLUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nlug-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nlug-talk/CAL9PgS3KSvaC5qg3mbWCJkQbmcTJ91_TgwSCdjDpF7LQjB6Ztg%40mail.gmail.com.

Reply via email to