View previous topic :: View next topic |
Author |
Message |
binro l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/gallery/The Fifth Element/movie_the_fifth_element_playa.gif)
Joined: 06 May 2005 Posts: 742 Location: Bangkok
|
Posted: Sun Apr 26, 2020 3:39 pm Post subject: Testing new root partition with VM |
|
|
I am rebuilding my server from scratch and want to test all the services are now starting correctly. I have a new virtual root partition /dev/vg00/new and was going to add a new section to /boot/grub/grub.cfg and then reboot the box. Then it occurred to me that using a VM would be easier (the server box is headless) but browsing the doc left me somewhat confused. I have use qemu before but that involved installing a new system into an image file; I already have an installed system so what to do? A possible procedure seems to be:
- Copy the boot partition into /dev/vg00/new.
- Install Grub2 into the new /dev/vg00/new.
- Convert /dev/vg00/new into an image file.
One problem seems to be my kernel uses modules and I don't want to build a new one, so that rules out qemu?
Any suggestions would be appreciated!
Thanks
Robin _________________ "Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Hu Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
Joined: 06 Mar 2007 Posts: 23100
|
Posted: Sun Apr 26, 2020 4:30 pm Post subject: |
|
|
Qemu can boot a kernel direct from the command line, so you can skip dealing with grub2 entirely for this test. However, if your kernel does not support the virtual hardware that Qemu will present, then you will need to rebuild it to include that support. You may or may not have the required virtual hardware supported in your current kernel. The most likely failure mode is that the guest fails to start all the way. Damaging your new root is very unlikely. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
binro l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/gallery/The Fifth Element/movie_the_fifth_element_playa.gif)
Joined: 06 May 2005 Posts: 742 Location: Bangkok
|
Posted: Sun Apr 26, 2020 5:21 pm Post subject: |
|
|
OK that's very useful to know! I will give it a try, I think all the virtual drivers atr enabled in the kernel.
Thanks. _________________ "Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
binro l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/gallery/The Fifth Element/movie_the_fifth_element_playa.gif)
Joined: 06 May 2005 Posts: 742 Location: Bangkok
|
Posted: Wed Apr 29, 2020 5:59 pm Post subject: |
|
|
I have been experimenting but qemu doesn't like my root device:
Code: |
qemu-system-x86_64 -kernel vmlinuz-5.4.6-gentoo \
-initrd initrd-5.4.6-gentoo \
-append "root=/dev/ram ro single real_root=/dev/mapper/vg00-new \
init=/linuxrc dolvm quiet CONSOLE=ttyS0" \
-m 512M \
-nographic
Reading all physical volumes. This may take a while...
.....
!! Block device /dev/mapper/vg00-new is not a valid root device ...
!! Could not find the root block device in /dev/mapper/vg00-new.
!! Please specify another value or:
!! - press Enter for the same
!! - type "shell" for a shell
!! - type "q" to skip ...
|
This is all the output I can see, if I don't use -nographic the boot just hangs. It looks like the initrd is not running and setting up LVM? The append line is what I have in my normal Grub boot.
Thanks. _________________ "Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Hu Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
Joined: 06 Mar 2007 Posts: 23100
|
Posted: Thu Apr 30, 2020 2:05 am Post subject: |
|
|
Is that the entire qemu command line you used? I don't see anything in it that would direct qemu to expose the block device to the guest, so there are no virtual hard drives for the guest to try to use. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
binro l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/gallery/The Fifth Element/movie_the_fifth_element_playa.gif)
Joined: 06 May 2005 Posts: 742 Location: Bangkok
|
Posted: Thu Apr 30, 2020 12:59 pm Post subject: |
|
|
I am copying various samples I found by searching. What would you suggest I add? I could use a -hda option to specify an image file but what would it be an image of?
Thanks _________________ "Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Hu Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
Joined: 06 Mar 2007 Posts: 23100
|
Posted: Fri May 01, 2020 1:20 am Post subject: |
|
|
-hda is an old name for the functionality that is more readily handled through -drive. You should point it to whatever file or block device you want to be seen as a virtual block device in the guest. Based on the remarks in your first post, I would try passing /dev/vg00/new as the device to expose. If you want to be particularly cautious, you could start off with -drive file=/dev/vg00/new,readonly=on to prevent the guest from writing to the device. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
binro l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/gallery/The Fifth Element/movie_the_fifth_element_playa.gif)
Joined: 06 May 2005 Posts: 742 Location: Bangkok
|
Posted: Mon May 04, 2020 2:24 pm Post subject: |
|
|
I tried adding -hda /dev/mapper/vg00-new to the parameter list but it made no difference. Qemu still complains vg00-new is not a valid root device. I will abandon this route and just re-boot the physical box! _________________ "Ship me somewheres east of Suez, where the best is like the worst,
Where there ain't no Ten Commandments an' a man can raise a thirst"
from "Mandalay" by Rudyard Kipling |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|