- PVSM.RU - https://www.pvsm.ru -
You want to have absolute disk speed? Let's see how it can be done in 2018 with versioning and automation.
bash
and sh
(debirf writen on sh
)dmesg|lspci
)/dev/sdb
to any else (/dev/sdd
)/root/Projects/debirf/
to your choice (/home/username/Documents/debirf
)/media/root/8B46-1189
to /media/username/myflashdrive
I think, you will need the non-free repository.
/usr/bin/debirf
like nano +107 $(which debirf)
create_debootstrap
local OPTS="
--components main,contrib,non-free
in bracketsLet's think, our flash drive:
/media/root/8B46-1189
./root/Projects/debirf/
apt-get install -yq debirf mtools genisoimage
mkdir -p /root/Projects/debirf
tar xzf /usr/share/doc/debirf/example-profiles/rescue.tgz -C /root/Projects/debirf
cd /root/Projects/debirf/rescue
DEBIRF_LABEL="debirf-rescue"
DEBIRF_SUITE=stretch
DEBIRF_DISTRO=debian
DEBIRF_MIRROR=http://ftp.ru.debian.org/debian/
debirf make .
and go away. It need many time, at minimal 15 minutes on top hardware.debirf makeiso .
for create not working iso (needed for grub.cfg file)I recommend you use bios legacy boot and package grub-pc. Not tested with UEFI, but must work. Next lines will be do:
mkdir -p /media/root/8B46-1189
mount /dev/sdb1 /media/root/8B46-1189
grub-install --boot-directory=/media/root/8B46-1189/boot /dev/sdb
cp /root/Projects/debirf/rescue/iso/boot/grub/grub.cfg /media/root/8B46-1189/boot/grub/
cp /root/Projects/debirf/rescue/*.cgz /media/root/8B46-1189
cp /root/Projects/debirf/rescue/vmlinuz-* /media/root/8B46-1189
umount /media/root/8B46-1189
rm -rf /media/root/8B46-1189
mkdir -p rescue/iso/isolinux/
wget -O rescue/iso/isolinux/isolinux.bin 'http://mirror.yandex.ru/centos/7/os/x86_64/isolinux/isolinux.bin'
cat << EOF > rescue/iso/isolinux/isolinux.cfg
TIMEOUT 5
DEFAULT lir
LABEL lir
LINUX /vmlinuz-4.9.0-7-amd64
INITRD /debirf-rescue_stretch_4.9.0-7-amd64.cgz
EOF
genisoimage -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -l -input-charset default -V LiR -A "Linux in RAM" -o rescue/rescue.iso rescue/iso/
apt-get install -yq qemu
qemu-system-x86_64 -enable-kvm -m 512 -hda /dev/sdb
-enable-kvm
Module — executable sh script for running during LiR creating
network
the resolving file will be changed to the system-resolved, and you can not work with the network.#DEBIRF_PACKAGE>+
$DEBIRF_ROOT
debirf_exec
cat <<< EOF > rescue/modules/mi
#!/bin/sh -e
# debirf module: mi
# prepare to run on mi notebook
#
# This script were written by
# Eduard Generalov <eduard@generalov.net>
#
# They are Copyright 2018, and published under the MIT,
#DEBIRF_PACKAGE>+firmware-iwlwifi
#DEBIRF_PACKAGE>+firmware-misc-nonfree
#DEBIRF_PACKAGE>+wpasupplicant
echo 'iwlwifi' >> $DEBIRF_ROOT/etc/modules
cat << EOF > $DEBIRF_ROOT/etc/wpa_supplicant/wpa_supplicant-wlp1s0.conf
ctrl_interface=/run/wpa_supplicant
update_config=1
network={
ssid="WiFi_SSID"
psk="WIFIPASSWORD"
}
EOF
cat << EOF > $DEBIRF_ROOT/etc/systemd/network/wireless.network
[Match]
Name=wlp1s0
[Network]
DHCP=ipv4
[DHCP]
RouteMetric=20
EOF
and replace line with resolved
in file rescue/modules/network with debirf_exec systemctl enable wpa_supplicant@wlp1s0.service systemd-networkd.service systemd-resolved.service
module rescue/modules/lxc
#!/bin/sh -e
# debirf module: lxc
# prepare lxc
#
# This script were written by
# Eduard Generalov <eduard@generalov.net>
#
# They are Copyright 2018, and published under the MIT,
#DEBIRF_PACKAGE>+lxc
mkdir -p $DEBIRF_ROOT/root/.ssh/
ssh-keygen -b 2048 -t rsa -f $DEBIRF_ROOT/root/.ssh/id_rsa -q -N ""
cp $DEBIRF_ROOT/root/.ssh/id_rsa $DEBIRF_ROOT/root/.ssh/authorized_keys
chmod 400 $DEBIRF_ROOT/root/.ssh/authorized_keys
debirf_exec systemctl enable lxc-net
cat << EOF > $DEBIRF_ROOT/etc/lxc/default.conf
lxc.network.type = veth
lxc.network.link = lxc
lxc.network.name = eth0
lxc.network.flags = up
lxc.network.hwaddr = 00:FF:AA:FF:xx:xx
lxc.mount.entry=/var/cache/apt var/cache/apt none bind,rw 0 0
lxc.mount.entry = /root/.ssh/ root/.ssh none bind,create=dir 0 0
EOF
cat << EOF > $DEBIRF_ROOT/etc/default/lxc-net
USE_LXC_BRIDGE="true"
LXC_BRIDGE="lxc"
LXC_ADDR="10.0.3.1"
LXC_NETMASK="255.255.255.0"
LXC_NETWORK="10.0.3.0/24"
LXC_DHCP_RANGE="10.0.3.2,10.0.3.254"
LXC_DHCP_MAX="253"
LXC_DHCP_CONFILE=""
LXC_DOMAIN="lxc"
EOF
От модератора: нам в Песочницу пришла статья на английском языке. Мы её прочитали и и в качестве пятничного эксперимента решили опубликовать. Не судите строго, всем peace and happy Friday! Let's come together! Короче, фром зе боттом оф ауа хартс.
Автор: EduardGeneralov
Источник [1]
Сайт-источник PVSM.RU: https://www.pvsm.ru
Путь до страницы источника: https://www.pvsm.ru/vy-sokaya-proizvoditel-nost/289587
Ссылки в тексте:
[1] Источник: https://habr.com/post/420501/?utm_campaign=420501
Нажмите здесь для печати.