Linksys AC Series Router Configuration Tips for OpenWRT: Difference between revisions

Line 2,956: Line 2,956:


====DD====
====DD====
A program that functions as a cloning utility is DD (noted in an earlier section for a different purpose).  When cloning an entire drive (SSD in the form of an mSATA, M.2 (NVME, NGFF), etc. device) / disk / flash drive* (* the term "drive" used later in this section will apply to whatever storage medium is being cloned), the image file should of couse be cloned to a separate device as with any other cloning software.  DD is capable of cloning an entire drive, etc. or a single partition
DD is a program that functions as a cloning utility, among other capabilities and functions (noted in an earlier section for a different purpose).  When cloning an entire drive (SSD in the form of an mSATA, M.2 (NVME, NGFF), etc. device) / disk / flash drive* (* the term "drive" used later in this section will apply to whatever storage medium is being cloned), the image file should of couse be cloned to a separate device as with any other cloning software.  DD is capable of cloning an entire drive, etc. or a single partition


Note, the DD command is built into BusyBox, but does not have all options available.  To take advantage of all the options DD offers, install the full package with this command: opkg install corutils
Note, the DD command is built into BusyBox, but does not have all options available.  To take advantage of all the options DD offers, install the full package with this command: opkg install corutils
Line 2,971: Line 2,971:
**conv = noerror = Don't stop on read errors, sync = If an error occurs use zeros or nuls to pad file, progress=show the progress
**conv = noerror = Don't stop on read errors, sync = If an error occurs use zeros or nuls to pad file, progress=show the progress


===== Tips =====
=====Examples=====
 
====== Prepare a Drive or Partition for Cloning ======
Before cloning a partition, to save space on the image file, "zero out" all unallocated space.
 
With every file system there are potentially sections of the drive that have had data written to them at some point in time that has since been erased.  And as we all know, when a file is "erased" from a drive, the actual file itself is left on the drive and the space it occupied is simply marked as available in a file system.  DD has no method of determining alocated or unallocated space.  It copies everything.  And in the below example where everything it copies is put into a compressed TAR file, compressing a bunch of zeros is very easy to make quite small.  IE, "zeroing out" unallocated space on a disk drive really reduces the size of an image file in a compressed file.  Advanced cloning utilities like Acronis True Image, Clonezilla, etc. take care of this automatically.  But since DD is a multifaceted utility that isn't specifically designed for cloning, it does not have this capability built in.
 
====== Examples ======
The below example writes 0s / zeros to a file named ZeroByteFile in a directory named overlay (that happens to be located on a USB Flash Drive) in 64 Kilobyte chunks (of all the words like portion, segment, section, piece, etc., chunk is the most commonly used word in this instance with block coming in second)
The below example writes 0s / zeros to a file named ZeroByteFile in a directory named overlay (that happens to be located on a USB Flash Drive) in 64 Kilobyte chunks (of all the words like portion, segment, section, piece, etc., chunk is the most commonly used word in this instance with block coming in second)


Line 3,010: Line 3,003:
**-t = the type of file system (this could be -t vfat, -t ntfs, -t ext2, etc., but it should obviously match the type of the original file system)
**-t = the type of file system (this could be -t vfat, -t ntfs, -t ext2, etc., but it should obviously match the type of the original file system)
**-o = Option (let the mount command know it is a "loop" device)
**-o = Option (let the mount command know it is a "loop" device)
=====Tips=====
======Prepare a Drive or Partition for Cloning======
Before cloning a partition to an image file, to save space on the image file, "zero out" all unallocated space.
With every file system there are potentially sections of the drive that have had data written to them at some point in time that has since been erased.  And as we all know, when a file is "erased" from a drive, the actual file itself is left on the drive and the space it occupied is simply marked as available in a file system.  DD has no method of determining alocated or unallocated space.  It copies everything.  And in the below example where everything it copies is put into a compressed TAR file, compressing a bunch of zeros is very easy to make quite small.  IE, "zeroing out" unallocated space on a disk drive really reduces the size of an image file in a compressed file.  Advanced cloning utilities like Acronis True Image, Clonezilla, etc. take care of this automatically.  But since DD is a multifaceted utility that isn't specifically designed for cloning, it does not have this capability built in.


====Good 'ole Fashion, just make a copy====
====Good 'ole Fashion, just make a copy====