Linux live cd восстановление

Linux mint восстановление системы с помощью LiveCD/USB

Сбой файловой системы в linux случается достаточно редко, но лично у меня пару раз такое происходило из-за экстренного выключения ноутбука, вместо традиционного завершения сеанса операционной системы. И, при следующем включении, дистрибутив просто не загружался и выводил ошибку в терминале о неисправности используемого сектора жесткого диска. Если вам приходилось видеть данную ошибку, то, скорее всего, проблема в коренном (чаще всего он и есть поврежденный) секторе файловой системы.

Для выполнения восстановления нам необходим любой современный LiveCD дистрибутив.
Загружаемся в LiveCD и заходим в терминал от имени суперпользователя.
Для восстановление файловой системы в linux используется консольная утилита под названием fsck. Её вызов очень прост даже для новичков в мире linux.

Последовательность действий:
1. Загружаемся с LiveCD дистрибутива linux, содержащего в себе драйвер для работы с вашей файловой системой (например ext4) и собственно утилиту fsck.
2. Заходим в терминал LiveCD под именем суперпользователя. Например, в той-же Ubuntu нужно просто набрать в основной консоли sudo su. В Debian есть отдельный пункт меню для вызова root консоли. В Gentoo вам вообще ничего не придется делать – после загрузки вы уже под именем root.
3. Если вы не помните путь до поврежденной файловой системы (/dev/sdx), то смотрите на вывод команды fdisk -l и ориентируясь на размер или другие параметры, запоминаете путь до файловой системы (например /dev/sda1).
4. Теперь осталось запустить утилиту восстановления файловой системы командой fsck -fy /dev/sdx , где sdx – имя раздела (например sda1). Опция -f (force) используется для принудительной выполнении проверки. Опция -y (yes) позволяет программе автоматически отвечать “да” на все вопросы в ходе работы.
Также стоит запомнить опцию -t которая задаёт тип файловой системы.
Вот так-бы выглядел запуск проверки диска у меня на ноутбуке:

Читайте также:  Linux резервное копирование инкрементное

В Ubuntu через определенное количество монтирований жестких дисков (читай «перезагрузок компьютера») принудительно включается fsck для проверки жестких дисков. Многие знают, что с помощью tune2fs можно управлять интервалами проверок fsck.

ВОССТАНОВЛЕНИЕ С ПОМОЩЬЮ LiveCD/USB

Запустите систему с LiveCD/USB и откройте терминал . Для этого

можно нажать Alt+F2 и ввести команду:

Далее необходимо узнать Вашу таблицу разделов. Используйте

На экран должна быть выведена примерно такая таблица:

/dev/sda1 29 8369 66999082+ 83 Linux
/dev/sda2 * 8370 13995 45190845 7 HPFS/NTFS
/dev/sda3 13996 14593 4803435 5 Extended

Из таблицы видим, что Linux стоит (в нашем случае) на разделе – /dev/sda1

  1. sudo su Права суперпользователя root
  2. fdisk -l Путь до поврежденной файловой системы Linux
  3. fsck -fy /dev/sdx Команда для восстановления. где sdx – имя раздела Linux (например sda1)

Источник

LiveCdRecovery

This page describes methods for using the Ubuntu Live CD for recovering from different kinds of problems. If you do not have an Ubuntu disk, please refer to GettingUbuntu. If you have any issues booting the LiveCD, please have a look at the BootFromCD page. Most of the methods described below can also be used from RecoveryMode

Lost Password

  1. Boot the Ubuntu Live CD.
  2. Press Ctrl-Alt-F1
  3. sudo mount /dev/sda1 /mnt
  4. If you created a custom partition layout when installing Ubuntu you have to find your root partition using the fdisk utility. See the section Finding your root partition.
  5. sudo chroot /mnt

You can now use the passwd command to reset a password.

Note: In the mount command, /dev/sda1 will need to be replaced with the partition where the root of the file system resides.

Add User to a Group

  1. Boot the Ubuntu Live CD.
  2. Press Ctrl-Alt-F1
  3. sudo mount /dev/sda1 /mnt
  4. sudo chroot /mnt
  5. adduser username groupname
Читайте также:  Создать iso usb linux

Update Failure

  1. Boot the Ubuntu Live CD.
  2. Press Ctrl-Alt-F1
  3. sudo mount /dev/sda1 /mnt
  4. sudo mount --bind /dev /mnt/dev
  5. sudo mount --bind /proc /mnt/proc
  6. sudo mount --bind /sys /mnt/sys
  7. sudo chroot /mnt
  8. apt update
  9. apt upgrade

If you have trouble accessing your network after chroot, you probably use DHCP and can work around this by adding OpenDNS name servers to your /etc/resolv.conf after you use chroot:

nameserver 208.67.222.222 nameserver 208.67.220.220

Finding your root partition

    If you are not using a software raid setup or have setup your partitions using LVM/2 or EVMS your IDE/SATA/SCSI devices should be accessible through the files /dev/hd[a-z] and /dev/sd[a-z]. /dev/hda corresponds to the primary master device on your IDE bus, while /dev/sda is your first SCSI/SATA device. If you are using software raid, LVM, LVM2 or EVMS, your devices may be listed in the following directories:

/dev/evms/dm if you are using software raid /dev/evms/lvm if you are using LVM /dev/evms/lvm2 if you are using LVM2 /dev/evms if you are using EVMS

This will produce some output like this:

Password: Disk /dev/sda: 120.0 GB, 120034123776 bytes 16 heads, 63 sectors/track, 232581 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 13206 6655792+ 7 HPFS/NTFS /dev/sda2 13207 232581 110565000 5 Extended /dev/sda5 228706 232484 1904616 82 Linux swap / Solaris /dev/sda6 13207 228705 108611464+ 83 Linux /dev/sda7 232485 232581 48856+ 83 Linux Partition table entries are not in disk order

That means you have two standard Linux partitions on your disk: /dev/sda6 and /dev/sda7. You can now try to mount them and see if your Ubuntu installation is there. In this case /dev/sda7 is probably not the root partition, because it is only about 50MiB in size (see the Blocks column). Therefore we mount /dev/sda6:

Now show the files on the partition:

Читайте также:  Windows file sharing with linux

If this command shows something like:

bin dev home media proc sbin tmp var boot etc lib opt root sys usr

it is a partition holding a Linux distribution. You can check if it really is Ubuntu (if you have multiple linux installations on your disk) using the following command:

That will give you some information about the distribution (if this file does not exist, it is probably not Ubuntu). If it is the wrong partition, just unmount it: sudo umount /mnt and try another partition on the same disk or choose a different partition on another disk (using fdisk as before).

Recover Grub 2

Recover Grub

  1. Boot the Ubuntu Live CD.
  2. Press Ctrl-Alt-F1
  3. Find the partition where your /boot directory is (normally the root partition) check the previous tip for that.
  4. sudo mount /dev/sda1 /mnt
  5. sudo chroot /mnt
  6. grub
  7. find /boot/grub/stage1 (will output a partition name like (hd0,3) )
  8. root (hd0,3)
  9. setup (hd0)
  10. quit
  11. Now restart the system and remove the Live CD

The GUI Way: Reinstalling Grub

  1. Boot your computer with the Ubuntu CD
  2. Go through the installation process until you reach «[. ] Disk Partition»
  3. Select Manual Partition
  4. Mount your appropriate linux partions:
    • /
    • /boot
    • swap
    • .
  5. DO NOT FORMAT THEM.
  6. Finish the manual partition
  7. Say «Yes» when it asks you to save the changes
  8. It will give you errors saying that «the system couldn’t install . » after that
  9. Ignore them, keep select «continue» until you get back to the Ubuntu installation menu
  10. Jump to «Install Grub . «
  11. Once it is finished, just restart your computer

See also

LiveCdRecovery (последним исправлял пользователь cpe-69-23-67-43 2016-03-22 04:04:08)

The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for details

Источник

Оцените статью
Adblock
detector