Nowe posty

xx Dystrybucja pod HP Omen (6)
Wczoraj o 23:30:08
xx [Poradnik] Wyszukiwanie Sterowników (2)
Wczoraj o 21:08:23
lamp Problem z Linux Lite po instalacji (0)
Wczoraj o 19:50:30
xx Ile pingwinów? (1)
Wczoraj o 08:59:24
xx konfiguracja pale moon (0)
2024-03-24, 21:53:42
xx Plasma 6 w Neonie ssie trochę mniej ... (10)
2024-03-23, 02:38:11
xx problem z instalacja sterowników do karty sieciowej (3)
2024-03-18, 18:10:16
xx Plik abc.001 (1)
2024-03-17, 17:48:27
xx Zlecę dopracowanie programu w MatLab (0)
2024-03-13, 15:28:40
xx Linux Mint 21.3 XFCE brak dźwieku po paru minutach (karta muzyczna zintegrowana) (5)
2024-03-12, 23:07:01

Autor Wątek: jak skopiować zawartość folderu boot z backupu?  (Przeczytany 1444 razy)

Offline kenpo

  • Users
  • Stały bywalec
  • ***
  • Wiadomości: 216
    • Zobacz profil
jak skopiować zawartość folderu boot z backupu?
« dnia: 2015-05-14, 12:07:50 »
Miałem osobną partycję na boot. Teraz straciłem jej zawartość. Został mi backup tej partycji z clonezilli, ale nie mogę go przywrócić bo są jakieś błędy (pokazuje, że partycja docelowa jest za mała).

Czy jest jakiś sposób żeby rozpakować zawartość backupu i skopiować go z zachowaniem uprawnień do pustego folderu /boot/grub tj. na partycji, na której jest cały system.

Edit:
Albo jeśli tak się nie da lub nie jest to proste to co zrobić żeby wypełnić folder boot odpowiednimi danymi, włącznie z odwołaniem do odpowiedniego kernela, tj. żeby powstały odpowiednie pliki konfiguracyjne.

Offline Paweł Kraszewski

  • Administrator
  • Guru
  • *****
  • Wiadomości: 3049
  • Lenistwo jest matką potrzeby = babcią wynalazku
    • Zobacz profil
jak skopiować zawartość folderu boot z backupu?
« Odpowiedź #1 dnia: 2015-05-14, 12:47:20 »
* Zrób plik wystarczająco duży, aby zmieściła się oryginalna partycja.
* Zamontuj go jaku urządzenie przez losetup.
* Odtwórz na to urządzenie (będzie /dev/loopCYFRA) backup
* Zamontuj sobie to urządzenie jakby to był pendrive
* Wykopiuj sobie wszystko potrzebne.

Na przyszłość zrzucaj dane TAR-em albo DAR-em. Zrzucają PLIKI, więc rozpakujesz na każdą partycję, byle się dane zmieściły.
Paweł Kraszewski
~Arch/Void/Gentoo/FreeBSD/OpenBSD/Specjalizowane customy

Offline kenpo

  • Users
  • Stały bywalec
  • ***
  • Wiadomości: 216
    • Zobacz profil
jak skopiować zawartość folderu boot z backupu?
« Odpowiedź #2 dnia: 2015-05-14, 14:15:06 »
"* Zrób plik wystarczająco duży, aby zmieściła się oryginalna partycja."
O jaki plik chodzi? Jak mam go zrobić?

W międzyczasie okazało się, że podczas odzyskiwania partycji i zapisu do MBR partycja boot została przemianowana z sda7 na sda2.

Próbowałem też z livecd zrobić chroot i grub-install i update-grub. Niby błędów nie pokazało, ale po uruchomieniu pokazuje tylko
grub>

Tak jakby grub nie mógł się odwołać do konkretnego kernela.
grub.cfg wygląda tak
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}
function recordfail {
  set recordfail=1
  if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}
function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  2b383205-d6e5-4711-adc8-83d841b090c7
else
  search --no-floppy --fs-uuid --set=root 2b383205-d6e5-4711-adc8-83d841b090c7
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
  set timeout=-1
else
  if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=hidden
    set timeout=0
  # Fallback hidden-timeout code in case the timeout_style feature is
  # unavailable.
  elif sleep --interruptible 0 ; then
    set timeout=0
  fi
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
#set_background_image "images/tile.png";

set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
if background_color 0,0,0; then
  clear
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
   set gfxpayload="${1}"
   if [ "${1}" = "keep" ]; then
      set vt_handoff=vt.handoff=7
   else
      set vt_handoff=
   fi
}
if [ "${recordfail}" != 1 ]; then
  if [ -e ${prefix}/gfxblacklist.txt ]; then
    if hwmatch ${prefix}/gfxblacklist.txt 3; then
      if [ ${match} = 0 ]; then
        set linux_gfx_mode=keep
      else
        set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=text
    fi
  else
    set linux_gfx_mode=keep
  fi
else
  set linux_gfx_mode=text
fi
export linux_gfx_mode

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
Może wiesz jak co zrobić, żeby pominąć tamtą partycję boot i żeby wypełnić katalog boot na partycji root tak żeby uruchomił się system?

Próbowałem użyć programu supergrub2, ale niestety nie uruchamia się. Wyskakuje komunikat "Failded to load COM32 file menu.c32" chociaż użyłem dobrego obrazu iso.

Próbowałem też z livecd programu  boot repair, ale tak długo pracował bez widocznych efektów (ok pół godziny) że w końcu go wyłączyłem.

Edit:
Dobra, udało się, po ponad 10 godzinach walki.
Zrobiłem to jakoś tak:

sudo mount --bind /dev /mnt/dev
sudo mount --bind /dev/pts /mnt/dev/pts
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys

lub to (już nie pamiętam) - nie zapisałem notatek, ale montowanie z chroot jest opisane na wielu stronach

kubuntu@kubuntu:~$ sudo mount -t ext4 /dev/sda1 /mnt
kubuntu@kubuntu:~$ sudo mount -t proc proc /mnt/proc
kubuntu@kubuntu:~$ sudo mount -t sysfs sys /mnt/sys
kubuntu@kubuntu:~$ sudo mount -o bind /dev /mnt/dev


kubuntu@kubuntu:~$ sudo chroot /mnt /bin/bash
root@kubuntu:/# apt-get update

root@kubuntu:/# apt-get install linux-generic
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages were automatically installed and are no longer required:
  plasma-scriptengine-python python-kde4
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  linux-headers-3.13.0-52 linux-headers-3.13.0-52-generic
  linux-headers-generic linux-image-3.13.0-52-generic
  linux-image-extra-3.13.0-52-generic linux-image-generic
Suggested packages:
  fdutils linux-doc-3.13.0 linux-source-3.13.0 linux-tools
The following NEW packages will be installed:
  linux-generic linux-headers-3.13.0-52 linux-headers-3.13.0-52-generic
  linux-headers-generic linux-image-3.13.0-52-generic
  linux-image-extra-3.13.0-52-generic linux-image-generic
0 upgraded, 7 newly installed, 0 to remove and 357 not upgraded.
Need to get 0 B/61.5 MB of archives.
After this operation, 271 MB of additional disk space will be used.
Do you want to continue? [Y/n]
E: Can not write log (Is /dev/pts mounted?) - openpty (2: No such file or directory)
Selecting previously unselected package linux-image-3.13.0-52-generic.
(Reading database ... 140967 files and directories currently installed.)
Preparing to unpack .../linux-image-3.13.0-52-generic_3.13.0-52.86_amd64.deb ...
Done.
Unpacking linux-image-3.13.0-52-generic (3.13.0-52.86) ...
Selecting previously unselected package linux-image-extra-3.13.0-52-generic.
Preparing to unpack .../linux-image-extra-3.13.0-52-generic_3.13.0-52.86_amd64.deb ...
Unpacking linux-image-extra-3.13.0-52-generic (3.13.0-52.86) ...
Selecting previously unselected package linux-image-generic.
Preparing to unpack .../linux-image-generic_3.13.0.52.59_amd64.deb ...
Unpacking linux-image-generic (3.13.0.52.59) ...
Selecting previously unselected package linux-headers-3.13.0-52.
Preparing to unpack .../linux-headers-3.13.0-52_3.13.0-52.86_all.deb ...
Unpacking linux-headers-3.13.0-52 (3.13.0-52.86) ...
Selecting previously unselected package linux-headers-3.13.0-52-generic.
Preparing to unpack .../linux-headers-3.13.0-52-generic_3.13.0-52.86_amd64.deb ...
Unpacking linux-headers-3.13.0-52-generic (3.13.0-52.86) ...
Selecting previously unselected package linux-headers-generic.
Preparing to unpack .../linux-headers-generic_3.13.0.52.59_amd64.deb ...
Unpacking linux-headers-generic (3.13.0.52.59) ...
Selecting previously unselected package linux-generic.
Preparing to unpack .../linux-generic_3.13.0.52.59_amd64.deb ...
Unpacking linux-generic (3.13.0.52.59) ...
Setting up linux-image-3.13.0-52-generic (3.13.0-52.86) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-52-generic /boot/vmlinuz-3.13.0-52-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-52-generic /boot/vmlinuz-3.13.0-52-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-52-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 3.13.0-52-generic /boot/vmlinuz-3.13.0-52-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.13.0-52-generic /boot/vmlinuz-3.13.0-52-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.13.0-52-generic /boot/vmlinuz-3.13.0-52-generic
Setting up linux-image-extra-3.13.0-52-generic (3.13.0-52.86) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-52-generic /boot/vmlinuz-3.13.0-52-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-52-generic /boot/vmlinuz-3.13.0-52-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-52-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 3.13.0-52-generic /boot/vmlinuz-3.13.0-52-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.13.0-52-generic /boot/vmlinuz-3.13.0-52-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.13.0-52-generic /boot/vmlinuz-3.13.0-52-generic
Setting up linux-image-generic (3.13.0.52.59) ...
Setting up linux-headers-3.13.0-52 (3.13.0-52.86) ...
Setting up linux-headers-3.13.0-52-generic (3.13.0-52.86) ...
Setting up linux-headers-generic (3.13.0.52.59) ...
Setting up linux-generic (3.13.0.52.59) ...
root@kubuntu:/# apt-get install linux-headers-generic
Reading package lists... Done
Building dependency tree      
Reading state information... Done
linux-headers-generic is already the newest version.
linux-headers-generic set to manually installed.
The following packages were automatically installed and are no longer required:
  plasma-scriptengine-python python-kde4
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 357 not upgraded.
root@kubuntu:/# apt-get install linux-image-generic  
Reading package lists... Done
Building dependency tree      
Reading state information... Done
linux-image-generic is already the newest version.
linux-image-generic set to manually installed.
The following packages were automatically installed and are no longer required:
  plasma-scriptengine-python python-kde4
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 357 not upgraded.
root@kubuntu:/# update-grub
/usr/sbin/grub-mkconfig: 250: /usr/sbin/grub-mkconfig: cannot create /boot/grub/grub.cfg.new: Directory nonexistent
root@kubuntu:/# sudo update-grub
sudo: unable to resolve host kubuntu
/usr/sbin/grub-mkconfig: 250: /usr/sbin/grub-mkconfig: cannot create /boot/grub/grub.cfg.new: Directory nonexistent
root@kubuntu:/# update-grub
/usr/sbin/grub-mkconfig: 250: /usr/sbin/grub-mkconfig: cannot create /boot/grub/grub.cfg.new: Directory nonexistent
root@kubuntu:/# uname -a
Linux kubuntu 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
root@kubuntu:/# sudo mount /dev/sda5 /mnt
sudo: unable to resolve host kubuntu
root@kubuntu:/# sudo mount /dev/sda1 /mnt
sudo: unable to resolve host kubuntu
root@kubuntu:/# mount /dev/sda1 /mnt
mount: /dev/sda1 already mounted or /mnt busy
mount: according to mtab, /dev/sda5 is already mounted on /mnt
root@kubuntu:/# grub-install
Installing for i386-pc platform.
grub-install: error: install device isn't specified.
root@kubuntu:/# grub-install --root-directory=/mnt /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.

root@kubuntu:/# grub-install --recheck /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
root@kubuntu:/# apt-get install --reinstall linux-generic
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages were automatically installed and are no longer required:
  plasma-scriptengine-python python-kde4
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 357 not upgraded.
Need to get 0 B/1,786 B of archives.
After this operation, 0 B of additional disk space will be used.
E: Can not write log (Is /dev/pts mounted?) - openpty (2: No such file or directory)
(Reading database ... 170612 files and directories currently installed.)
Preparing to unpack .../linux-generic_3.13.0.52.59_amd64.deb ...
Unpacking linux-generic (3.13.0.52.59) over (3.13.0.52.59) ...
Setting up linux-generic (3.13.0.52.59) ...
root@kubuntu:/# update-grub
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-3.13.0-52-generic
Found initrd image: /boot/initrd.img-3.13.0-52-generic
Found linux image: /vmlinuz-3.13.0-52-generic
Found initrd image: //initrd.img-3.13.0-52-generic
done
root@kubuntu:/# exit
kubuntu@kubuntu:~$
Będę musiał się nauczyć lepszego, tj. jakiegoś bardziej przejrzystego sposobu na robienie backupu niż clonezilla. Chociaż ona nie jest taka zła. :)

Niemniej dziękuję za pomoc.