- Unix etc.
- Unix, Linux and related technologies.
- Create a Recovery USB Stick in Linux
- Select a Spare USB Stick
- Choose the Rescue System
- Download GParted
- Write the Image to USB
- Boot from USB
- SystemRescueCD
- Linux Mint
- Conclusion
- 2 thoughts on “ Create a Recovery USB Stick in Linux ”
- Leave a Reply Cancel reply
- USB storage devices
- Contents
- Auto-mounting with udisks
- Manual mounting
- Getting a kernel that supports usb_storage
- Identifying device
- Mounting USB memory
- As root
- Allow writing by regular users
- As normal user with fstab
- Mount tools
- Troubleshooting
- No USB storage devices are acknowledged by the system
- USB device detected but not mountable
- Device not shutting down after unmounting all partitions
- Usb stick with linux
- 2. Requirements
- 3. USB selection
- 4. Boot selection and Partition scheme
- 5. Select the Ubuntu ISO file
- 6. Write the ISO
- 7. Additional downloads
- 8. Write warnings
- 9. Writing the ISO
- 10. Installation complete
Unix etc.
Unix, Linux and related technologies.
Create a Recovery USB Stick in Linux
A recovery USB stick is a bootable USB drive that can be used to rescue a system or perform critical maintenance. It’s a useful tool to have around. Typically, a system of interest is booted from the USB stick, maintenance is performed, then the repaired system is rebooted from its own disk. Below is a simple guide to creating a number of rescue USB sticks.
A Rescue stick can help fix many system problems, such as a system that won’t boot, a broken GRUB configuration, a disk or other hardware problem. By allowing the whole operating system to be taken offline, a rescue USB allows maintenance of a kind that cannot be performed any other way.
It is easy to create a bootable USB stick in Linux. In these examples, I used a Raspberry Pi, but any Linux PC would do equally well.
Select a Spare USB Stick
Find a suitable USB stick. It doesn’t have to be anything fancy. An old one is fine. Make sure it is USB 2.0 (or 3.0) and at least 2 GB in size. In these examples I am using an old Bytestore 2 GB.
Choose the Rescue System
A wide range of bootable environments are available. We are going to look at three of them. The first is GParted, a small Linux distro designed specifically for partitioning your disk. The next, SystemRescueCD, is larger. It can partition disks too, but comes with many other recovery tools and a more usable environment then GParted. Linux Mint os the third environment and will be looked at last. It is a full Linux distribution.
Download GParted
Open a browser and surf to the GParted download page. About half way down is a table of Stable Releases. Click on the latest 32 bit version, and save the file. At the time of writing (May 2019), the latest version is 0.33.0-2. By the time you read this, it might well have been updated. (Note that the download redirects to SourceForge).
Alternatively, and it might be a bit easier, just grab the file with one command. Right-click on the download link, choose “Copy link location”, then use wget and paste the URL:
The GParted download is about 350 MB.
Write the Image to USB
Plug in your USB stick. If it mounts, unmount it. Use fdisk –l to check the device name, as follows.
fdisk -l prints lots of stuff about all disks and partitions on my system. I can identify that the USB stick is /dev/sdb because that is the only device that is close to 2 GB in size, and my USB stick, as stated above, is 2.0 GB. (It shows up as 1.9 GB here).
Warning: The following command will erase all data currently on your USB stick. If you need to keep that data, do not proceed. Also, before typing the following command, be absolutely certain that you are using the correct device (/dev/sdb in this example, but it might well be different on your system). If you were to use the wrong device with this dd command, it could potentially destroy your system by overwriting part of your root disk. Please take care.
Having identified the right device, proceed as follows to write the image to it.
The dd command should take about 5 minutes on less. On a Raspberry Pi 2 it was just over 2 minutes.
Boot from USB
Put the USB stick into a convenient PC or laptop. Switch the machine on. (You might have to fiddle with the BIOS settings to tell the system to look for bootable USB devices). If it is working, you will see the USB boot menu, briefly, followed by a boot sequence. Click “Ok” when it asks about keymaps. The select a keyboard (I chose “02” for British), then choose option “0” to go straight into a graphical desktop.
In a minute the GParted screen appears. The GParted application itself is running in a Window. Apart from that, you are looking at Fluxbox, a sparse (but very compact) graphical window system. Right click anywhere to open a terminal or other application. At your disposal are Netsurf, a basic browser, various terminals, but not much else. When you have finished messing about, shut the system down and remove your USB.
SystemRescueCD
The GParted environment is fine, but is really just intended for disk partitioning. SystemRescueCD offers a richer environment and comes with a bigger variety of tools. Download the latest ISO from the SystemRescueCD downloads page. The image size is about 800 MB. At the time of writing (May 2019), release 6.0.3 is the latest, so I will just grab it directly:
As before, write the ISO to the USB stick. This should take 5 minutes or so:
Put the newly created SystemRescueCD USB stick into the PC of interest and boot from it. You will see the boot menu – press [Enter] to accept the default. A textual screen appears. To start the graphical environment, type “startx“, as instructed. In a few moments you will be looking at an XFCE graphical interface.
This is a much richer environment than GParted/Fluxbox. For a start, Firefox is available, instead of Netsurf. So is the GParted disk partitioning tool, in fact, as well the LVM subsystem and various applications useful in a rescue situation.
Linux Mint
Putting a full Linux distribution onto a USB key is just as easy. You just need a bigger drive though. In this example, Linux Mint MATE is installed. Instead of a 2.0 GB stick, I will use a 32GB Corsair drive. As before, download the latest version of Linux mint, then dd it onto the stick.
For this example I will grab it with wget. You should probably use a browser,
Writing to the USB stick takes about 10 minutes:
Afterwards, put the drive into your PC of interest and power on. It should boot into Linux Mint 19.2 without further intervention. Mint is, of course, a full desktop distribution. Not necessarily intended for use in a rescue or maintenance situation. But it could be used in one, coming with GParted, the LVM subsystem and many useful tools.
Conclusion
Having a SystemRescueCD USB drive around is always handy. It is a good idea to pack one in your laptopn bag. And update update it every so often. SystemRescueCD is a live project and new releases are quite frequent.
2 thoughts on “ Create a Recovery USB Stick in Linux ”
So is that just for Linux system or can i write a ISO win 10 boot to the USB as i seem not to be able to get a working win 10 USB and i want to replace my Linux system.
Hi Darrel. The procedure is for Linux only.
Leave a Reply Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Источник
USB storage devices
This document describes how to use the popular USB memory sticks with Linux. However, it is also valid for other devices such as digital cameras that act as if they were just a USB storage device.
If you have an up-to-date system with the standard Arch kernel and a modern Desktop environment your device should just show up on your desktop, with no need to open a console.
Contents
Auto-mounting with udisks
This is the easiest and most frequently used method. It is used by many desktop environments, but can be used separately too.
See Udisks for detailed information, including list of mount helpers.
Manual mounting
Getting a kernel that supports usb_storage
If you do not use a custom-made kernel, you are ready to go, for all Arch Linux stock kernels are properly configured. If you do use a custom-made kernel, ensure it is compiled with SCSI-Support, SCSI-Disk-Support and usb_storage. If you use the latest udev, you may just plug your device in and the system will automatically load all necessary kernel modules.
Identifying device
The first thing one needs to access a storage device is its identifier assigned by kernel. See fstab#Identifying filesystems for details.
Mounting USB memory
You need to create the directory in which you are going to mount the device:
As root
This article or section is a candidate for merging with File_systems#Mount_a_file_system.
Mount the device as root with this command (do not forget to replace device_node by the path you found):
If mount does not recognize the file system of the device you can try to use the -t argument, see mount(8) for details. If mounting does not work, you can try to recreate the file system or even repartition the disk.
Allow writing by regular users
If you want non-root users to be able to write to the USB stick, you can issue the following command:
If it does not work, make sure that the file system is mountable and writable as root, see the previous section for details.
As normal user with fstab
See FAT#Writing to FAT32 as normal user if you want normal user to do the mount/unmount action.
Mount tools
Multiple mount tools facilitate mounting as a regular user.
Troubleshooting
No USB storage devices are acknowledged by the system
If you have connected your USB storage device to the computer and it is not listed by lsblk or dmesg, ensure that your BIOS has both XHCI Handoff and EHCI Handoff enabled.
USB device detected but not mountable
If you recently upgraded you kernel, the modules for USB storage for your currently running kernel were removed and replaced with modules for the newly installed kernel. These modules will not be loaded until you reboot and run the new kernel.
Device not shutting down after unmounting all partitions
This article or section needs expansion.
Failure to power off a device might result in:
- a hard disk drive not parking its head, making a faint scratching sound while spinning out and degrading the device [2], or
- a solid-state drive (especially older) not flushing its cache buffers or updating its mapping tables, and losing data [3].
When you unmount the partitions, the device is still powered on. You should ask the system to turn it off first in order to safely remove it: [4]
If you use udisks, you can use these commands: [5]
Источник
Usb stick with linux
With a bootable Ubuntu USB stick, you can:
- Install or upgrade Ubuntu
- Test out the Ubuntu desktop experience without touching your PC configuration
- Boot into Ubuntu on a borrowed machine or from an internet cafe
- Use tools installed by default on the USB stick to repair or fix a broken configuration
Creating a bootable Ubuntu USB stick from Microsoft Windows is very simple and we’re going to cover the process in the next few steps.
Alternatively, we also have tutorials to help you create a bootable USB stick from both Ubuntu and Apple macOS.
2. Requirements
- A 4GB or larger USB stick/flash drive
- Microsoft Windows XP or later
- Rufus, a free and open source USB stick writing tool
- An Ubuntu ISO file. See Get Ubuntu for download links
Take note of where your browser saves downloads: this is normally a directory called ‘Downloads’ on your Windows PC. Don’t download the ISO image directly to the USB stick! If using Windows XP or Vista, download version 2.18 of Rufus.
3. USB selection
Perform the following to configure your USB device in Rufus:
- Launch Rufus
- Insert your USB stick
- Rufus will update to set the device within the Device field
- If the Device selected is incorrect (perhaps you have multiple USB storage devices), select the correct one from the device field’s drop-down menu
You can avoid the hassle of selecting from a list of USB devices by ensuring no other devices are connected.
4. Boot selection and Partition scheme
Now choose the Boot selection. Choices will be Non bootable and FreeDOS. Since you are creating a bootable Ubuntu device select FreeDOS.
The default selections for Partition scheme (MBR) and Target system (BIOS (or UEFI-CSM)) are appropriate (and are the only options available).
5. Select the Ubuntu ISO file
To select the Ubuntu ISO file you downloaded previously, click the SELECT to the right of “Boot selection”. If this is the only ISO file present in the Downloads folder you will only see one file listed.
Select the appropriate ISO file and click on Open.
6. Write the ISO
The Volume label will be updated to reflect the ISO selected.
Leave all other parameters with their default values and click START to initiate the write process.
7. Additional downloads
You may be alerted that Rufus requires additional files to complete writing the ISO. If this dialog box appears, select Yes to continue.
8. Write warnings
You will then be alerted that Rufus has detected that the Ubuntu ISO is an ISOHybrid image. This means the same image file can be used as the source for both a DVD and a USB stick without requiring conversion.
Keep Write in ISO Image mode selected and click on OK to continue.
Rufus will also warn you that all data on your selected USB device is about to be destroyed. This is a good moment to double check you’ve selected the correct device before clicking OK when you’re confident you have.
If your USB stick contains multiple partitions Rufus will warn you in a separate pane that these will also be destroyed.
9. Writing the ISO
The ISO will now be written to your USB stick, and the progress bar in Rufus will give you some indication of where you are in the process. With a reasonably modern machine, this should take around 10 minutes. Total elapsed time is shown in the lower right corner of the Rufus window.
10. Installation complete
When Rufus has finished writing the USB device, the Status bar will be green filled and the word READY will appear in the center. Select CLOSE to complete the write process.
Congratulations! You now have Ubuntu on a USB stick, bootable and ready to go.
If you want to install Ubuntu, take a look at our install Ubuntu desktop tutorial.
Источник