Production environment
System: linux
Make
- Use the
lsblk
command to view the serial number of the hard disk mirrored
lsblk
- Make a hard disk image
sudo dd bs=512 count=117229568 if=/dev/sdc | gzip -9 > image-os.gz
Description ::
count
The size of the hard disk to be mirrored needs to be calculated according to the size of the hard disk
bs
: the size of a write block
sdc
: the serial number of the hard disk to be mirrored, check the hard disk according to lsblk to modify this
Image compression split and decompression merge
- Compression and splitting
The image obtained by dd is generally relatively large and cannot be stored on the CD. The image can be split by the following command, and the split image file can be obtained in the current directory
mkdir image
mv image-os.gz image
tar cjf - image |split -b 3800m - image-os.tar.bz2.
Description ::
-b
Split by file size
- Unzip and merge
execute the following command in the directory where the image file is located, you can get the unzipped and merged image file in the current directory
cat image-os.tar.bz2.a* |tar xj
Mirror installation
- Use the
lsblk
command to view the hard disk serial number of the installed image
lsblk
- Mirror installation
gzip -c -d image-os-os.gz | sudo dd of=/dev/sdc
sdc
: The serial number of the hard disk to be installed mirrored, according to lsblk to view the hard disk to modify this