Что такое офлаг в dd? [дубликат]

Что означает oflag в команде dd ?

Какие есть варианты oflag = ?

В настоящее время я выполняю dd if = / dev / zero of = / dev / sdb bs = 4096

Чтобы стереть диск .

1
задан 8 November 2019 в 10:21

1 ответ

Взятый прямо от info dd

(примечание: это было взято от поля [Lubuntu] 20.04; таким образом, это может содержать флаги, которые не существуют в Вашей версии, таким образом, Вы - лучшее использование info dd на Вашем собственном поле для наблюдения точно, что доступно для системы)

oflag=FLAG [ФЛАГ]... ’ Получают доступ к выходному файлу с помощью флагов, указанных аргументом (аргументами) ФЛАГА. (Никакие пробелы вокруг любой запятой (запятых).)

 Here are the flags.  Not every flag is supported on every operating
 system.

 ‘append’
      Write in append mode, so that even if some other process is
      writing to this file, every ‘dd’ write will append to the
      current contents of the file.  This flag makes sense only for
      output.  If you combine this flag with the ‘of=FILE’ operand,
      you should also specify ‘conv=notrunc’ unless you want the
      output file to be truncated before being appended to.

 ‘cio’
      Use concurrent I/O mode for data.  This mode performs direct
      I/O and drops the POSIX requirement to serialize all I/O to
      the same file.  A file cannot be opened in CIO mode and with a
      standard open at the same time.

 ‘direct’
      Use direct I/O for data, avoiding the buffer cache.  Note that
      the kernel may impose restrictions on read or write buffer
      sizes.  For example, with an ext4 destination file system and
      a Linux-based kernel, using ‘oflag=direct’ will cause writes
      to fail with ‘EINVAL’ if the output buffer size is not a
      multiple of 512.

 ‘directory’

      Fail unless the file is a directory.  Most operating systems
      do not allow I/O to a directory, so this flag has limited
      utility.

 ‘dsync’
      Use synchronized I/O for data.  For the output file, this
      forces a physical write of output data on each write.  For the
      input file, this flag can matter when reading from a remote
      file that has been written to synchronously by some other
      process.  Metadata (e.g., last-access and last-modified time)
      is not necessarily synchronized.

 ‘sync’
      Use synchronized I/O for both data and metadata.

 ‘nocache’
      Request to discard the system data cache for a file.  When
      count=0 all cached data for the file is specified, otherwise
      the cache is dropped for the processed portion of the file.
      Also when count=0, failure to discard the cache is diagnosed
      and reflected in the exit status.

      Note data that is not already persisted to storage will not be
      discarded from cache, so note the use of the “sync” options in
      the examples below, which are used to maximize the
      effectiveness of the ‘nocache’ flag.

      Here are some usage examples:

           # Advise to drop cache for whole file
           dd if=ifile iflag=nocache count=0

           # Ensure drop cache for the whole file
           dd of=ofile oflag=nocache conv=notrunc,fdatasync count=0

           # Advise to drop cache for part of file
           # Note the kernel will only consider complete and
           # already persisted pages.
           dd if=ifile iflag=nocache skip=10 count=10 of=/dev/null

           # Stream data using just the read-ahead cache.
           # See also the ‘direct’ flag.
           dd if=ifile of=ofile iflag=nocache oflag=nocache,sync

 ‘nonblock’
      Use non-blocking I/O.

 ‘noatime’
      Do not update the file’s access timestamp.  *Note File
      timestamps::.  Some older file systems silently ignore this
      flag, so it is a good idea to test it on your files before
      relying on it.

 ‘noctty’
      Do not assign the file to be a controlling terminal for ‘dd’.
      This has no effect when the file is not a terminal.  On many
      hosts (e.g., GNU/Linux hosts), this option has no effect at
      all.

 ‘nofollow’
      Do not follow symbolic links.

 ‘nolinks’
      Fail if the file has multiple hard links.

 ‘binary’
      Use binary I/O.  This option has an effect only on nonstandard
      platforms that distinguish binary from text I/O.

 ‘text’
      Use text I/O.  Like ‘binary’, this option has no effect on
      standard platforms.

 ‘fullblock’
      Accumulate full blocks from input.  The ‘read’ system call may
      return early if a full block is not available.  When that
      happens, continue calling ‘read’ to fill the remainder of the
      block.  This flag can be used only with ‘iflag’.  This flag is
      useful with pipes for example as they may return short reads.
      In that case, this flag is needed to ensure that a ‘count=’
      argument is interpreted as a block count rather than a count
      of read operations.

 ‘count_bytes’
      Interpret the ‘count=’ operand as a byte count, rather than a
      block count, which allows specifying a length that is not a
      multiple of the I/O block size.  This flag can be used only
      with ‘iflag’.

 ‘skip_bytes’
      Interpret the ‘skip=’ operand as a byte count, rather than a
      block count, which allows specifying an offset that is not a
      multiple of the I/O block size.  This flag can be used only
      with ‘iflag’.

 ‘seek_bytes’
      Interpret the ‘seek=’ operand as a byte count, rather than a
      block count, which allows specifying an offset that is not a
      multiple of the I/O block size.  This flag can be used only
      with ‘oflag’.

 These flags are not supported on all systems, and ‘dd’ rejects
 attempts to use them when they are not supported.  When reading
 from standard input or writing to standard output, the ‘nofollow’
 and ‘noctty’ flags should not be specified, and the other flags
 (e.g., ‘nonblock’) can affect how other processes behave with the
 affected file descriptors, even after ‘dd’ exits.

man dd предоставил бы быструю manual.reference.page информацию, поскольку много комплексов управляют, чтобы можно было использовать info для просматривания других страниц.

0
ответ дан 7 December 2019 в 18:11

Другие вопросы по тегам:

Похожие вопросы: