Computer lessons

GRUB recovery. How to fix GRUB2 if Ubuntu does not want to boot How to restore the Ubuntu operating system without reinstalling

As you know, when using Windows and Linux on the same computer, it is recommended to install Linux, including Ubuntu, after Windows is installed. This is due to the fact that the Ubuntu installation program detects the operating systems already installed on the computer, adds them to its bootloader, and when you start the computer, you can choose which operating system you want to run. As for Windows, its installation program detects only other versions of Windows, and it simply ignores all other operating systems, such as Linux, FreeBSD, MacOS, and so on. Therefore, if you install Windows AFTER installing Ubuntu, you will lose the ability to boot into Ubuntu. The most clumsy way to get Ubuntu booting again is to reinstall it again. Of course, in this case you lose all your settings, installed programs and user files. I already wrote how to do it differently here: . But the method, to be honest, is a bit difficult for beginners. Today I will talk about another, completely simple way to restore the Ubuntu bootloader and “fix” the loading of operating systems - the boot-repair program.

The boot-repair program has two operating modes: simple and advanced.

When you start the program, you are taken to a simple mode where you can choose 2 options: automatically detect the problem and fix the boot system (fixes the most common problems), or create a BootInfo report to receive help by mail or on the forum - the second option is suitable for novice users, who do not understand anything about the advanced mode of operation of the program and want to ask for help on the forum or from specialists (a detailed report is generated on boot records, the installed bootloader, operating systems and hard drive partitions).

In advanced mode, the program provides a huge number of settings and functions with which advanced users can manually fix boot problems.

If you installed Windows after Ubuntu or lost the ability to boot for some other reason, it is recommended that you try automatic repair first - it will most likely help you.

Installing boot-repair on Ubuntu

To install boot-repair on Ubuntu installed on your computer, or running from a flash drive or disk, you need an Internet connection. Open a terminal (CTRL+ALT+T) and run the following commands:

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install boot-repair

Boot disk with boot-repair

You can also download boot-repair boot disk (available in 32-bit and 64-bit versions) so you can burn it to a disk or create a bootable flash drive and fix boot problems on your computer (or use this very useful tool to fix problems on your clients' computers).

Have you often encountered situations where you needed to recover data? You accidentally deleted the file, but when it was too late you came to your senses, but did not know how to restore it; as an option, you installed the operating system and, out of ignorance of disk layout, formatted the disk with all the data, music, movies, home photos and other other data. You are in despair, not knowing whether it is possible to recover, you have restored everything bit by bit, but this is only the smallest part of solving the consequences of the problem that has arisen, data in Linux can be recovered and for this there are utilities, both paid and free, and today we will discuss 7 utilities that will help with recovery data in Ubuntu Linux.

Partially, of course, all this helped, but most of the data was still lost, and imagine the situation, you are a student, preparing a coursework, there is a week or two left before it is due, and your hard drive on which your coursework was on crashed, what to do in this situation.

I know that many users are accustomed to working with a graphical interface from the time they worked on the system, but today we will also discuss console utilities, since many of them help in recovery no worse, and in some situations even better.

How to recover data and what applications to use?

How to recover data using Scalpel utility

Scalpel is a set of tools for fast file recovery. A unique utility, its uniqueness lies in the fact that it does not depend in any way on the file system. The utility searches the database for files of all known formats and tries to find them on the disk using its own specific patterns, looking at the beginning and end of the file. It can help in recovery in such file systems as FATx, NTFS, ext2/3, also from “RAW” partitions.

Let's install the utility, run the command in the terminal:

sudo apt install scalpel

the utility works according to its internal template /etc/scalpel/scalpel.conf, if you want to recover files of a certain format, you should open the config and uncomment the corresponding lines for this type of file. When editing a config template, you need to be very careful not to break it or delete anything unnecessary.

Example of using Scalpel:

sudo scalpel file.iso -o dir_recovery

recovery directory" dir_recovery" must be empty file.iso this is an example of the data that we need to recover, we know that we had such an image with exactly the same name, we can specify not only the file directly, but we can also specify the full path to the device from which we need to restore, like this /dev/sdb1/directory_name/directory_name2/filename.

How to recover data using R-Linux

R-Linux is a free program for recovering Ext2/Ext3/Ext4 FS file systems used in Linux and some Unix operating systems (OS). Used in R-Linux Scanning technology and an easy-to-set program interface give the user absolute control over the data recovery process. The program recovers data from existing logical drives, even if file records are lost. However, the program does not have the ability to restore data over a network, as well as functionality for reconstructing disk arrays and recovering data from them.

There are two versions of the R-Linux utility: for Linux OS and for Windows OS. They have the same functionality, the only difference is the host OS.

R-Linux recovers the following files:

  • Deleted as a result of a virus attack, power failure or system damage;
  • From damaged or deleted partitions, after formatting the partition, even to a partition with a different file system;
  • When the partition structure on the disk has been changed or damaged. In this case, R-Linux can scan the hard drive, find a previously deleted or damaged partition, and only then recover data from the found partition.
  • From hard drives that have a large number of bad sectors. R-Linux allows you to copy information and create an image of an entire disk or part of it, and only then work with the image file saved on another medium, as with the original disk. This is especially useful and effective when the number of bad sectors on the disk is constantly growing, and the remaining information needs to be saved immediately.

What R-Linux can do:

  • Host Operating System (OS):
  • Option for Linux OS: any Linux OS based on kernel 2.6+
  • Option for Windows OS: Win2000, XP, 2003, Vista, Windows 7, Windows 8/8.1, Windows Server 2008/2012
  • Supported file systems: Ext2/Ext3/Ext4 FS (Linux) only.
  • Recognition and analysis of Dynamic (Windows 2000/XP/2003/Vista/Win7), Primary, BSD (UNIX) partition schemes and APM (Apple Partition Map) partition schemes. Support for dynamic partitions on GPT as well as on MBR.
  • Creating an IMAGE FILE for an entire physical disk, partition or part thereof. Disk image files can be processed by the program as a regular disk. Two types of images are possible: 1) Images that are an exact byte-by-byte copy of the object (Uncompressed images) - such images are compatible with previous versions of R-Linux; 2) Compressed images - can be compressed, split into multiple files and password protected. Such images are fully compatible with images created by the R-Drive Image program, but are incompatible with previous versions of R-Linux.
  • Recovered files can be saved to any drive, including a network drive, accessible by the local operating system.
  • Monitoring S.M.A.R.T parameters R-Linux can display S.M.A.R.T parameters. (Self-Monitoring, Analysis and Reporting Technology) for hard drives that show the state of their hardware and predict their possible failures. Any additional load on such disks should be avoided if warnings from the S.M.A.R.T system appear.
  • Search for deleted versions of files. R-Linux can search for deleted versions of files using their sizes, names, extensions and recognized file types as search parameters.

If there is something you don’t understand about the application, you can read the reference manual using the links / the manual is quite extensive, you will find answers to many questions.

How to install R-Linux

You can download the file for your architecture from the link - then to install, open a terminal and run the commands:

Cd ~/Downloads/ cd ~/Downloads/ sudo dpkg -i rli*

after installation is complete, look for the application in Ubuntu menu - System utilities - R-Linux, after the first launch you will see an English-language application, do not be alarmed, “Russian” support is also present. Go to Help menu - Interface Language, and select Russian, done.

If you need to restore files, connect a flash drive as an example, you see that the flash drive is detected, on the Ubuntu sidebar, click the update button in the application to see your media. Next, select a section of our flash drive with the mouse cursor and press the button " Scan".

As you can see, we are offered to configure the scanning parameters in more detail, whether to search by known file types, whether to keep a log, where specifically to search, we are allowed to specify from which segment of bytes the scanning should begin, from 0 according to the standard, or to specify your own data.

The scanning has started, we wait until it is completed, we do not cancel it in any case, sometimes this can end badly for the flash drive. The scanning is completed, then we see the following picture:

Below under our flash section there is an area called " Found by signatures", click on this section with the mouse cursor and we will see a new window:

click on the line " Files found based on information about typical features of their data structure". After clicking on this link we will see something like the following:

Select the directories you need and press the button " Restore marked", I checked for the sake of a test, the utility works well, try it and report back based on the results of how it works in a real situation when data is lost, files are deleted, etc.

How to recover data using the R-Studio utility

It's a paid utility, but it's worth it because it will help you out of even the most difficult situations. You can buy it on the official website -. An advanced utility, the best among data recovery utilities, works with file systems NTFS, NTFS5, ReFS, FAT12/16/32, exFAT, HFS/HFS+ (Macintosh), Little and Big Endian variants of UFS1/UFS2 (FreeBSD/OpenBSD/NetBSD /Solaris) and Ext2/Ext3/Ext4 FS (Linux). R-Studio also uses signature-based file recovery (scanning search for known file types) for severely damaged or unknown file systems. The program allows you to recover data both locally and on remote computers over a network, even if disk partitions have been formatted, damaged or deleted.

R-Studio includes:

  • RAID reconstruction module
  • Universal text/hexadecimal editor with a wide range of capabilities
  • A separate system and data backup module (disk copy), which allows R-Studio to be considered the most optimal and complete solution when creating a workstation for data recovery.

R-Studio recovers files:

  • Deleted outside the Recycle Bin or when the Recycle Bin was emptied;
  • Deleted by a virus attack or computer power failure;
  • After the partition with the files has been reformatted, even to a partition with a different file system;
  • When the partition structure on the hard drive has been changed or damaged. In this case, using the R-Studio program, you can scan your hard drive, find a deleted or damaged partition, and only then recover data from the found partition.
  • From hard drives that have a large number of bad sectors. The R-Studio recovery program can first copy information and create an image of the whole disk or part of it, and only then work with the image file saved on another medium as with the original disk. This is especially useful and effective when the number of bad sectors on the disk is constantly growing, and the remaining information needs to be saved immediately.
  • By Order of the Ministry of Justice of the Russian Federation dated November 26, 2015 No. 269, R-STUDIO was included in the list of requirements for the minimum configuration of the material and technical base for several types of forensic examinations carried out in federal budgetary forensic institutions of the Ministry of Justice of the Russian Federation.

What the R-Studio utility can do:

  • Standard Windows Explorer user interface.
  • Host operating system (OS): Windows 2000, XP, 2003 Server, Vista, 2008 Server, Windows 7, Windows 8/8.1/10, Windows Server 2012.
  • Data recovery over the Internet. Files can be recovered over the network from remote computers running Win2000/XP/2003/Vista/2008/Windows 7/8/8.1/10/Windows Server 2012, Macintosh, Linux and UNIX.
  • Supported file systems: FAT12, FAT16, FAT32, exFAT, NTFS, NTFS5, ReFS (the new local file system introduced by Microsoft in Windows 2012 Server), HFS/HFS+ (Macintosh), Little and Big Endian variants of UFS1/UFS2 (FreeBSD /OpenBSD/NetBSD/Solaris) and Ext2/Ext3/Ext4 FS (Linux).
  • Search for Known File Types when Scanning (recovering files by signature): if the file system on the disk is severely damaged or unknown, then R-Studio searches for data patterns (file signatures) characteristic of certain file types (Microsoft Office documents, jpgs, etc.) . If necessary, the user can add new file types to R-Studio.
  • Recognition and analysis of Basic (MBR), GPT and BSD (UNIX) partition schemes, as well as Apple partition schemes. Support for Dynamic Volumes (Windows 2000-2012/8.1/10) on MBR and GPT.
  • Support for Windows Storage Spaces (Windows 8/8.1 and 10/Threshold 2), Apple software RAID and Linux Logical Volume Manager (LVM/LVM2). R-Studio can automatically recognize and collect the components of these disk managers even if their databases are slightly damaged. Their components with seriously damaged databases can be added manually.
  • Reconstruction of damaged disk arrays (RAID). If the OS does not recognize the disk array (RAID), you can create a virtual RAID from its components. Such a virtual array can be processed by the program as a regular physical one. Supports standard RAID levels: 0, 1, 4, 5, 6. Supports nested and non-standard levels: 10(1+0), 1E, 5E, 5EE, 6E. Parity delay support for all relevant RAID levels. Support for custom RAID schemes.
  • Automatic recognition of RAID parameters.R-Studio is able to recognize all parameters for RAID 5 and 6. This allows the user to solve one of the most difficult tasks in RAID recovery - determining its parameters.
  • Creating an IMAGE FILE for an entire Physical Disk (HD), Partition or part thereof. Such image files can be compressed and split into several files for saving on CD/DVD/Flash or FAT16/FAT32/exFAT. Disk image files can be processed by the program as a regular disk.
  • Recovering data from damaged or deleted partitions, encrypted files (NTFS 5), alternative data streams (NTFS, NTFS 5).
  • Data recovery after:
  • launching FDISK or similar utilities;
  • Virus attack; FAT damage; MBR destruction.
  • Localized name recognition.
  • Recovered files can be saved to any drive, including a network drive, accessible by the local operating system. Recovered files can be saved to another drive on a connected remote computer without being downloaded over the network to the local computer.
  • View file contents to assess recovery chances. The contents of most file types (formats) can be viewed even if the application corresponding to the file is not installed.
  • Files or disk contents can be viewed and edited using the built-in hex editor. The editor supports editing properties of NTFS files.
  • Monitoring S.M.A.R.T. parameters R-Studio can display S.M.A.R.T. parameters. (Self-Monitoring, Analysis and Reporting Technology) for hard drives that show the state of their hardware and predict their possible failures. Any additional load on such disks should be avoided if warnings from the S.M.A.R.T system appear.
  • Integration with DeepSpar Disk Imager - a professional hard drive imaging device specifically designed for data recovery from failed drives. This integration provides low-level, thin access to drives with a certain level of hardware failure. Moreover, it allows you to create a disk image and perform analysis at the same time. That is, any sector accessed by R-Studio on the source disk will be immediately copied to the clone disk, and all subsequent data recovery operations will be performed on the clone disk to prevent further deterioration of the source disk and significantly reduce the time processing.

Of course, not all utilities for data recovery are described above, there is also a list of such utilities as Unrm, Giis, Ddrescue, DMDE, PhotoRec, Mondo Rescue and Safecopy, I described only the main ones, about other utilities and their capabilities, I would advise you to familiarize yourself with the material - . This is probably the end of the material, there will be questions, ask, clarify and leave feedback about the utilities you used that you recovered data, maybe the article doesn’t contain what you use, describe in the comments what you use.

GRUB(English) GR and U nified B ootloader) is an operating system loader from the GNU project. GRUB allows the user to have several operating systems installed and, when turning on the computer, select one of them to boot, including Windows.

Sometimes it happens that after installing one of the Linux OS Near Windows, the user needs to reinstall Windows OS. But after reinstallation Windows OS bootloader not displayed GRUB and only loads Windows, Although Linux OS has not disappeared from the hard drive. This happens because the bootloader MBR (M aster B oot R ecord) from Windows erases GRUB and doesn't allow you to download Linux OS installed next to Windows.

In this case, to restore the bootloader GRUB The utility will help the user Boot Repair(Boot recovery).

There are two recovery options GRUB With Boot Repair after installation Windows.

1. Download from the official site iso image With Boot-Repair-Disk and write it to a flash drive.
2. Load into live mode from any system Ubuntu or derivatives, install the utility Boot Repair and perform recovery GRUB.

Let's take a closer look at both possibilities.

Possibility 1 With Boot-Repair-Disk

For recording iso image V Windows there is an excellent utility Rufus. You can download it from the official website using the following link: https://rufus-usb.ru.uptodown.com/windows.

Now boot from the flash drive to live mode with the created image Boot-Repair-Disk.


As you can see in the picture, after scanning the systems, a single window will open - Boot recovery.

All you have to do is press the button GRUB.
GRUB.

Possibility 2 With Boot Repair

Boot from a flash drive with any iso image installed on it Ubuntu or derivatives V live mode.

For example, I had at hand a recorded image with the system being developed Ubuntu Mate 18.10(this is not so important. You may have a different image).


After loading the system in live mode, open a web browser and enter into the search engine boot-repair and click on the first link Boot-Repair - Community Help Wiki - Ubuntu Documentation:


In the page that opens we find terminal installation commands Boot Repair:


And we execute them one by one in the terminal (Ctrl+Alt+T).

Note. While executing commands in the terminal in live mode You do not need to enter a password, but the program will install.

After executing the commands and scanning the systems, a window will open - Boot recovery.



Just like in the first option, you just have to press the button Recommended recovery method and wait for the bootloader recovery to complete GRUB.
And then log out of the system, i.e. restart your computer to ensure recovery GRUB.

Conclusion.

Both options do the same thing. Restore GRUB.

Only in the first option you need to download the image Boot-Repair-Disk, load it onto a USB flash drive, and then enter live mode Boot-Repair-Disk and do a restore GRUB.

And in the second option it is enough to use the installation image Ubuntu or derivatives(which you may have saved on a flash drive), install boot-repair and also do a restore GRUB.

Which method to choose is up to you.

P.S. If you have questions about this article, you can discuss them on our forum.

How to restore your Ubuntu system to its previous state It would be great to be able to try a new version of Ubuntu, knowing that you can always go back to a previous version if you don't like this one. We will show you a utility that allows you to take a snapshot of your system at any time. TimeShift is a free tool similar to the System Restore feature in Windows. It allows you to take a snapshot of your system and then record changes at intervals. TimeShift only protects system files and settings, not user files such as documents, pictures and music. You can use a utility such as Back In Time to back up your user files. Note - when in this article we ask you to enter something surrounded by quotes, do not enter quotes unless we tell you to do so separately. We told you once , how to backup your applications and PPAs using a tool called Aptik, included in the same PPA as TimeShift. First, use the keyboard shortcut Ctrl+Alt+T to open a terminal window. If you have not installed Aptik, enter the following two commands (separately), pressing Enter after each command, to add the PPA and update information about packages available on the system. These two commands are: sudo apt-add-repository -y ppa:teejee2008/ppa sudo apt-get update If you installed Aptik, then you are ready to install TimeShift on your system, and you do not need to enter the previous commands. Now run this command: sudo apt-get install timeshift Enter your password when prompted and press Enter. Once the installation is complete, close the terminal window by running the "exit" command in it or by clicking the X button in the upper left corner of the window. To open TimeShift, click on the search button at the top of the Unity launcher panel. Enter timeshift in the search field. Search results appear as you enter characters. When the TimeShift icon appears, click on it to open the application. A dialog box will open asking for your password. Enter your password in the appropriate field and click OK (the password is required to obtain administrative rights to access system files. The main TimeShift window will appear, in which the system size is assessed. The Backup Device drop-down list allows you to select the partition or device to back up ( if you have several) The amount of required space required for the snapshot is displayed in the lower status bar. Snapshots are saved to the selected device, so make sure you have enough space to store a full system snapshot. To make a backup of the selected device, you need to click the Backup button on the toolbar. While the snapshot is being created, the message “Synching files...” is displayed in the bottom status line. When the snapshot is ready, it will be displayed with the date and time and system version. The status bar displays how much space is free in the system after taking a snapshot, as well as the date the last snapshot was taken. By hovering your mouse over the "Backup Device" drop-down list, you will see the path where snapshots are saved on your selected device. The timeshift directory contains various snapshots taken using TimeShift, including scheduled snapshots, which we'll talk about later in this article. The shapshots folder contains snapshots that you took manually. We recommend that you copy the folder to a USB flash drive, network device, cloud service (for example, Dropbox or Google Drive) in case something happens to the local copy. You can see the contents of the image by clicking the "Browse" button. The image folder is open in file manager window, and it lists directories and files from your system (without user files, remember). You can configure various application settings, such as automatic backups, or choose whether old snapshots will be automatically deleted. To open the settings, use the "Settings" button on the toolbar. The "Schedule" tab allows you to determine the time when snapshots will be taken. Click or drag the ON/OFF slider button to the on position for "Scheduled Snapshots". Click the checkboxes in the "Enable" column to define time intervals for taking snapshots. The "Auto-Remove" tab allows you to automatically delete old snapshots so you don't run out of hard drive space. There is a rule for every type of shot. For each type, you need to enter a limit after which TimeShift will delete old snapshots. For example, you can select a limit for the free disk space on the disk. The "Advanced" tab allows you to exclude specific files, directories and their contents from snapshots, as well as include additional files and folders. When you are finished configuring the application settings, click Save. If you If you want to restore a snapshot, open TimeShift, select the snapshot, and click Restore. Note - depending on the state of your system, you may need to reinstall TimeShift. The Target tab in the Restore dialog box allows you to specify the device to which you will restore the selected snapshot. Moving the mouse to a device in the list will display more information about that device to restore the snapshot. Select "Device for Restoring Snapshot" and "Device for Bootloader Installation." Use the "Exclude" tab to select applications for which you would like to keep the current settings and not restore from the previous ones. The Advanced tab allows you to exclude individual files and directories, as well as include them in the restored system. To close TimeShift, click on the X button in the upper left corner of the main window. TimeShift is a useful utility if you like to experiment with system updates or if something goes wrong with your system. Just like using System Restore in Windows, you can easily return your system to a previous working state instead of having to reinstall it.

Hello. Recently I came across a situation several times where, for one reason or another, my Linux boot loader crashed. At the same time, it crashed 2 times due to Windows updates, it stupidly erased Grub. You may also need to restore it if you install Windows next to Linux.

Today I will show you a very simple way on how you can restore this system bootloader.

First, let's boot from the Ubuntu LiveCD.

We launch the terminal and type there:

Sudo su add-apt-repository ppa:yannubuntu/boot-repair apt update apt install boot-repair boot-repair

The program window will open. In most cases, to restore the bootloader it is enough to select Recommended repair. That's what we'll do. Click on this button.

If a window with instructions appears, read them carefully and do what is written. In my case, it required 2 steps that had to be done manually in the terminal (uninstalling and reinstalling Grub).

After completing them, click forward and wait for the process to complete. If no errors appear, the bootloader will have to recover. Reboot the system and check.