banner
xingli

xingli

猫娘爱好者

The most powerful dd script for Linux

Preparations for dd#

Remember to update the source before downloading and install the wget component. The following commands correspond to the original system:

Debian-based (Debian Kali Ubuntu):

apt update
apt update install wget -y

Red Hat-based (CentOS AlmaLinux RockyLinux Fedora, etc.):

dnf install wget -y

AlpineLinux (requires installing the wget bash component and changing the system's default shell from ash to bash):

apk update
apk install wget bash
sed -i 's/root:\/bin\/ash/root:\/bin\/bash/g' /etc/passwd

Download and run the script:

wget --no-check-certificate -qO InstallNET.sh 'https://raw.githubusercontent.com/leitbogioro/Tools/master/Linux_reinstall/InstallNET.sh' && chmod a+x InstallNET.sh

For machines in China, you can now download from Gitee:

wget --no-check-certificate -qO InstallNET.sh 'https://gitee.com/mb9e8j2/Tools/raw/master/Linux_reinstall/InstallNET.sh' && chmod a+x InstallNET.sh

Quick start (only valid when the script is not accompanied by parameters such as -pwd, -port, -mirror, etc. If they are included, the corresponding version number of the distribution must be specified!):

No need to specify the architecture (-v option has been replaced by -version, and both have been deprecated), the script will automatically detect the architecture and intelligently convert between Debian-based and Red Hat-based architectures!

Debian 12 (supports 9 to 12)

bash InstallNET.sh -debian

Kali rolling (supports rolling/dev/experimental branches, rolling is recommended in principle)

bash InstallNET.sh -kali

Alpine Linux edge (supports 3.16 to 3.18 and edge, edge is recommended)

A lightweight Linux distribution, but please note that Alpine Linux saves memory when running, with memory usage of only about 80m. However, it does not save memory during installation because it completes all initialization operations in memory and then writes to the hard disk. Unlike Debian and Red Hat-based systems, which start the kernel in memory and then perform disk formatting and file writing operations from the mirror source to the hard disk, this means that Alpine Linux has higher memory requirements for installation. Machines with less than 1GB of memory should not install it. Since the Alpine Linux iPXE boot document only describes how to boot from the IPv4 network through DHCP or static, machines with only IPv6 public network access should not install it either. For dual-stack machines, the IPv6 part will be automatically configured during the installation process.

bash InstallNET.sh -alpine

CentOS 9 stream (supports 7-9)

bash InstallNET.sh -centos

AlmaLinux 9 (supports 8-9)

bash InstallNET.sh -alma

RockyLinux 9 (supports 8-9)

bash InstallNET.sh -rocky

Fedora 38 (supports 37-38)

bash InstallNET.sh -fedora

Ubuntu 22.04 (supports 20.04 or 22.04)

bash InstallNET.sh -ubuntu

Windows Server 2022 (based on dd in AlpineLinux, supports automatic recognition of corresponding dd packages under different firmware for BIOS and UEFI, supports Windows 10 Enterprise LTSC, Windows 11 Pro for Workstation 22H2, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019, Windows Server 2022. When reinstalling, enter the corresponding version number of the system. If you can log in to the system via VNC, it can automatically configure IPv4 static and automatically expand the system disk partition. The dd package is from Qiushui Yibing. Thanks again for his selfless dedication.)

bash InstallNET.sh -windows

Start dd#

The default password is as follows:

Due to the use of plaintext (unencrypted ciphertext transmitted only as local variables, not to other places) to pass the password parameter to the configuration file in Alpine Linux and Ubuntu, adding special characters may cause errors during sed processing. Therefore, the default password for Alpine Linux and Ubuntu is unified as LeitboGi0ro and cannot be modified temporarily.

If you want to customize the password, you can add -pwd 'password content' to modify it. It is recommended to enclose the password field with single quotation marks (' ') before and after to prevent the shell from treating the password with special characters in double quotation marks (" ") as a command, causing errors. The password should not be too long or too complex. For example:

If you are using the default password, please change it immediately after installation!

The default SSH port is the same as the original system. For example, if the SSH port of your machine's original system is 65432, the port number of the newly installed system will also be 65432. You can also add -port "port number" to modify it. It supports all supported Linux systems. The range is "1-65535". If the original system port is given incorrectly or cannot be determined, the fallback value is:

For example:

How to use this script to dd from Linux to Windows?

  1. For any machine based on KVM QEMU or XEN, regardless of whether the original system of the machine is Debian-based or Red Hat-based, the grub boot menu can be successfully written and restarted:
bash InstallNET.sh -dd 'DD image link'
  1. For some dedicated servers that support multiple boot modes, such as rescue mode and normal mode, such as Kimsufi:

Switch the boot mode to rescue mode, obtain the login account password from the email, enter the rescue mode temporary system, and execute:

wget -O- 'DD image link' | xzcat | dd of=/dev/sda

Wait for the dd image to be downloaded and decompressed, change the boot mode to normal mode, enter the reboot command, and wait for the Windows system being dd'ed to complete initialization.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.