`cp --sparse=always`에는 어떤 단점이 있나요?

`cp --sparse=always`에는 어떤 단점이 있나요?

이유가 있나요?아니요--sparse=always모든 통화에 사용하시겠습니까 cp?

info cp설명하다:

‘--sparse=WHEN’
     A “sparse file” contains “holes”—a sequence of zero bytes that does
     not occupy any physical disk blocks; the ‘read’ system call reads
     these as zeros.  This can both save considerable disk space and
     increase speed, since many binary files contain lots of consecutive
     zero bytes.  By default, ‘cp’ detects holes in input source files
     via a crude heuristic and makes the corresponding output file
     sparse as well.  Only regular files may be sparse.

    The WHEN value can be one of the following:

...

    ‘always’
          For each sufficiently long sequence of zero bytes in the input
          file, attempt to create a corresponding hole in the output
          file, even if the input file does not appear to be sparse.
          This is useful when the input file resides on a file system
          that does not support sparse files (for example, ‘efs’ file
          systems in SGI IRIX 5.3 and earlier), but the output file is
          on a type of file system that does support them.  Holes may be
          created only in regular files, so if the destination file is
          of some other type, ‘cp’ does not even try to make it sparse.

또한 다음과 같이 말합니다.

[...] 다음 별칭을 사용하면 "cp"는 파일 시스템에서 지원하는 최소 공간을 사용합니다.

alias cp='cp --reflink=auto --sparse=always'

--sparse=always왜 기본값 이 아닌가 ?

답변1

이것이 기본값이 아닌 데에는 여러 가지 이유가 있습니다. 하나는 이전 버전과의 호환성, 성능, 그리고 마지막으로 최소한의 놀라움의 원칙입니다.

제가 이해한 바에 따르면 이 옵션을 활성화하면 CPU 오버헤드가 발생하는데, 이는 반드시 허용될 수는 없으며 이전 버전과의 호환성이 중요합니다. 이 cp명령은 없이도 안정적으로 작동하며 약간의 공간을 절약하지만 현재로서는 적어도 대부분의 경우에는 실제로 무시할 수 있습니다.

귀하가 받은 의견은 다른 이유를 강조했다고 생각합니다.

최소 놀라움의 원칙은 불필요하게 무언가를 변경하지 않는다는 것을 의미합니다. cp이는 수십 년 동안 사용되어 왔으며 기본 동작을 변경하는 것은 많은 베테랑에게 불안할 것입니다.

관련 정보