If you wish to install base from prebuilt archive follow next steps:
- Create empty raw virtual hard disk image or connect physical drive, logical volume, iSCSI LUN and etc. Command for 30GB raw disk image creation:
qemu-img create -f raw hdd.img 30G
- Create partition table on disk image using fdisk, parted, gparted. For parted command should be
parted hdd.img
- Make system partition and make it bootable.
- Add other partitions if needed. You can also place data partition, compilation partition and swap partition. If you using virtual machine you can use disks against partitions.
- If you use disk image mount it to mapper via kpartx:
kpartx -av hdd.img
- Format main partition on proper mouted loop (be careful if you mount mutiple loops):
mkfs.ext4 /dev/mapper/loop0p1
- Make directory according to archive name ("build_dir" for "build_dir.tar.gz" archive)
mkdir -v build_dir
- Mount disk image partition to created directory:
mount /dev/mapper/loop0p1 build_dir
- Extract archive to directory
tar -xf build_dir.tar.gz
- Check files in directory
ls -l build_dir
- Check /etc/fstab and /boot/grub files for correct root device path (/dev/vda1 - for VirtIO disk, /dev/sda1 - for SAS,SCSI,SATA,IDE). If needed correct it.
- Go to directory with image and unmount disk image partition and mapping
umount /dev/mapper/loop0p1
kpartx -dv hdd.img
- Create virtual machine (We recomend to use virtual-manager for simplicity). Please use "hypervisor default" cpu model if you wish to operate ULFS32 because threre are bug in qemu on some prccessors like AMD Ryzen CPUs.
- Connect hard disk image (hdd.img) and grub rescue cd image (grub.iso) to virtual machine, and set cdrom as boot image
- Start a virtual machine. Grub rescue shell should apear
- List available devices:
ls
- If (hd0,1) is found, try to find vmlinuz file in this partition: List available devices
ls (hd0,1)/boot/vmlinuz
- If vmlinuz file is found, try to select it for boot on virtio disk (vda1):
linux (hd0,1)/boot/vmlinuz root=/dev/vda1 ro
or on other disk (sda1)
linux (hd0,1)/boot/vmlinuz root=/dev/sda1 ro
- Boot the system by runnin boot command without arguments:
boot
- When system is booted login as root with empty password
- Install grub loader to MBR on virtio disk
grub-install /dev/vda
on other disk disk:
grub-install /dev/sda
- After instaling grub loader shoutdown a VM and try to boot it from hard drive. System shoud start automaticaly.