[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: General method for copying a partition



On Wed, 17 Feb 2010 15:04:32 -0500 (EST), Boyd Stephen Smith Jr. wrote:
> On Wednesday 17 February 2010 13:40:20 Stephen Powell wrote:
>> On Wed, 17 Feb 2010 12:26:43 -0500 (EST), Boyd Stephen Smith Jr. wrote:
>>> Use this instead:
>>> cp -a /media/. /mnt
>>> OR
>>> cp -a /media/{.[!.],}* /mnt
>> 
>> Your second method doesn't work in ash because ash does not support
>> brace expansion.
>
> Sorry, I sometimes forget that brace expansion isn't part of the standard 
> Shell Command Language.
> 
> You could write them out separately:
> cp -a /media/.[!.]* /media/* /mnt
> BUT
> That could still fail depending on how your shell treats patterns that do not 
> match any existing pathnames (standard behavior is to leave the pattern 
> string, but both bash and zsh have options of different behavior) and how your 
> cp utility handles source_file arguments that do not exist.

All valid points.  I'm going with

   cp -a /media/. /mnt

There will always be a "/media/." directory.  And although rsync is a nice
tool, the specific application here is copying from one local filesystem
to another local filesystem, the target having just been formatted with mkfs
prior to mounting and is therefore totally empty.  Therefore, there is no
"synchronization" needed.  "Copy everything" is the order of the day.
Furthermore, rsync is not part of the standard system, nor is it available
when using the Debian Installer in a rescue-like mode.  (Still, rsync is a
nice tool to know about; and I'm glad that the posts concerning it were made.)

Thanks to all responders!  You've thought of several methods that I never would
have thought of on my own.


Reply to: