0

I have a notebook which can't boot up Ubuntu and I want to copy all of the files to an external hard drive with USB connection to save them. After I want to install a new Ubuntu to the notebook, how can I copy all of the files to an external hard drive using just the grub console, or (initramfs) console?

Update:

sudo lsblk
sudo: lsblk: command not foud
sudo vgscan
No volume groups found
sudo lvs
No volume groups found

Is this possible?

  • even the live usb, live cd doesn't see my files, that's why I need to use grub or initramfs – gabor aron Sep 4 '18 at 17:56
1

After I want to install a new Ubuntu to the notebook, how can I copy...

I think you mean first copy the files to an external drive, then reinstall Ubuntu.

You can't copy files with the GRUB console: the filesystem drivers of GRUB are basically read-only. (You can write into e.g. the /boot/grub/grubenv file, but only by overwriting its existing contents - you cannot increase the size of the file.)

With the initramfs console, you would first mount the necessary filesystems (= at least the filesystem you want to copy from and the filesystem of the external hard drive you want to copy to.), and then use the regular cp command to copy the files.

But there is probably a better option: prepare an Ubuntu Live DVD/USB, boot from it, and then you have all the basic filesystem manipulation tools (even GUI!) available to you.

  • I tried with a live cd, but it does not see the filesystem... I tried also with USB live, also the same problem... – gabor aron Sep 4 '18 at 17:59
  • Is the source filesystem encrypted, or configured with LVM, or some other complication? There may be some steps you need to take first. Please boot with a Live USB, run sudo lsblk and sudo vgscan; sudo pvs; sudo lvs and edit the outputs into your original question. – telcoM Sep 4 '18 at 18:05
  • no, it isn't, but seems to be something wrong with (initramfs) because I can't cd to ` home` folder for example. and it says /bin/sh: fsck: not found if I try to run fsck. – gabor aron Sep 4 '18 at 18:08
  • I updated my question but I don't know if this is a possible result, because I see the system files from grub – gabor aron Sep 4 '18 at 18:31
  • In (initramfs), the real root filesystem may not be mounted yet: you have a very basic environment which does not include /home, for example. If you see system files from GRUB, you are most likely seeing the contents of /boot, which is often a separate filesystem when disk encryption and/or LVM is used. And the first command I asked for was sudo lsblk, as in "LiSt BLocK devices", not "lbsk". – telcoM Sep 4 '18 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.