[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Restore backup to KVM



	Hi.

On Wed, Sep 27, 2017 at 06:56:27PM +0200, solitone wrote:
> On 27/09/17 14:01, solitone wrote:
> > Although mkfs had warned me, I mistakenly formatted the entire file,
> > like this:
> > 
> > $ sudo mkfs.ext4 restore.img
> > 
> > Now I've redone it the right way, using a loop device, and I'll see how
> > it goes.
> 
> It's a struggle! Now that I partitioned the image file, it sees /dev/sda1.
> There was an inconsistency between the filesystem size and the physical size
> of the device though, that I repaired with resize2fs, specifying the
> physical number of blocks.

And that's good.


> Now it finally mounts /dev/sda1, but on /root rather than on /, as it did
> before with the unpartitioned image file (/dev/sda):
> 
> ======================================================================
> Begin: Will now check root file system ... fsck from util-linux 2.29.2
> [/sbin/fsck.ext4 (1) -- /dev/sda1] fsck.ext4 -a -C0 /dev/sda1
> /dev/sda1: clean, 434181/5898240 files, 15163981/23592711 blocks
> done.
> [   33.088863] EXT4-fs (sda1): mounted filesystem with ordered data mode.
> Opts: (null)
> done.
> Begin: Running /scripts/local-bottom ... done.
> Begin: Running /scripts/init-bottom ... mount: mounting /dev on /root/dev
> failed: No such file or directory
> mount: mounting /dev on /root/dev failed: No such file or directory
> done.
> mount: mounting /run on /root/run failed: No such file or directory
> run-init: opening console: No such file or directory
> Target filesystem doesn't have requested /bin/bash.
> run-init: opening console: No such file or directory
> run-init: opening console: No such file or directory
> run-init: opening console: No such file or directory
> run-init: opening console: No such file or directory
> run-init: opening console: No such file or directory
> No init found. Try passing init= bootarg.
> 
> 
> BusyBox v1.22.1 (Debian 1:1.22.0-19+b3) built-in shell (ash)
> Enter 'help' for a list of built-in commands.
> 
> (initramfs) df
> Filesystem           1K-blocks      Used Available Use% Mounted on
> udev                     46448         0     46448   0% /dev
> tmpfs                    11684        60     11624   1% /run
> /dev/sda1             92365508  58650588  28980000  67% /root
> (initramfs)
> ======================================================================

And that means I have to take my words back. You cannot use stock Debian
initrd in these conditions.

It's not that you did something wrong at creating filesystem this time.

It's initrd that first tries to mount tmpfs filesystems on /root (and
fails), and only *then* mounts your root filesystem to /root (with the
intention to switch to it as /).

I have this feeling that you could workaround it by using custom-built
initrd, but I need to think through the details.

Reco


Reply to: