Drive hard linux usb

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]

Читайте также:  Защита от нсд средствами windows

If you use udisks, you can use these commands: [5]

Источник

Make a bootable USB drive on any Linux distro

In this post, you will learn how to make a bootable USB drive in Linux system using the native Linux tools.

I know that many of you are scared of the Linux command line. Of course, you can use graphical programs to make a bootable USB in Linux. But believe me, you will benefit so much if learn the Linux command line tools. For example, if you need to make a bootable USB drive in Linux, different distributions provide different graphical programs to do that, but every Linux distribution has the same built-in tool to do the same job. So, you will benefit for it long-term.

Make a bootable USB drive in Linux

To make a bootable USB drive in Linux, you just need to learn one simple command. The command is dd .

Options explained:

sudo means to give admin privileges to this command.

dd is the program name.

bs=4M means to use a block size of 4M, so the system will read and write the data in chunks of 4M. This option is simply meant to speed up the process.

if specifies the source to read. Simply put, this is an ISO file of the Linux image you download from the Linux distribution website.

path-to-the-ISO — path to the ISO file. For example,

of specified the destination or where to write this ISO file. In other words, it is your USB drive. This is the most important part of the command, If you do mistake here, you can screw up your whole system. So, be very-very careful.

/dev/sdX means the name assigned to a device by your Linux system. It is some kind of analogy of disks C, D, E in Windows systems.

To find out the name Linux assigned to your flash drive, run this command:

Then you need to analyze the output like the one above. Usually, the USB devices are listed at the end. You find your flash drive by its size. It usually has only one partition. I know that my flash drive is 15Gb. So, its name is sdd. This name is not permanent and it depends on the order the drives are mounted to the system. So, you need to check your USB drive name every time you insert it into the computer

status=progress is not necessary. However, it is helpful because it will show you the progress during the writing process. Without this option, nothing will be printed on the terminal screen.

sync is actually another command, not an option. Sync clears the cache. Thanks to the && signs it will be executed as a chain with dd. This will make sure that all the data is written to the flash drive and nothing is left in the cache.

NOTE: I also need to WARN you that this procedure will wipe all the data from your USB flash drive. So, if you have any important data on it, copy it somewhere else before you run this command. I also recommend to back up the data from other hard drives, so you do not destroy them accidentally.

So, when you are sure that there is no valuable data on the flash drive and you specified all the names correctly, especially the of option, press Enter.

It usually takes several minutes to complete. When the process is finished, you can reboot your system and boot from a newly created bootable USB.

That is the way you can make a bootable USB drive in Linux.

Restore the USB drive

After you have used the bootable USB flash drive, you need to restore it back to its normal not-bootable state. So, to do that, you need to remove the bootable system from it. Run this command:

Then, where again sdX is your flash drive name without any number (in my case it is sdd). You can check it with:

Читайте также:  Чем отличается профессиональная от домашней версии windows

After that create a new partition on it:

Select dos option.

And press enter to create a new partition.

Keep it at its maximum size. So, press enter.

Next, press enter again to make it primary. Navigate with the arrow keys to write and press Enter to write the changes.

Finally, type yes to confirm and quit the program.

Then, run this command, to check if a new partition has been created:

As you can see, the new partition has been created. It is named sdd1 in my example.

Then, format this partition as FAT file system:

Where ‘ALU’ is the label I give to this drive, you can use your name instead. And sdd1 is the partition name. Unlike in all the previous steps, where you used the device names, in this command you need to specify the partition name which ends with the number.

After these uncomplicated steps, your flash drive is like new and you can use it to store files.

Conclusion

Now you know how to make a bootable USB drive in Linux. You can now proceed to the installation process or test Linux live distributions.

So, leave your comment and give your opinion about this tutorial. Did you like it? Did you know about this tool?

Источник

How to Install Linux OS on USB Drive and Run it On Any PC

Ever thought of using any computer which is not yours, with all your personal stuff and configuration? It is possible with any Linux distribution. Yes! You can use your own, customized Linux OS on any machine with just a USB drive.

This tutorial is all about installing Latest Linux OS on your pen-drive ( fully reconfigurable personalized OS, NOT just a Live USB ), customize it, and use it on any PC you have access to. Here I am using Lubuntu 18.04 Bionic beaver for this tutorial (but, you can use any Linux distribution). So let’s gets started.

Requirements:

  1. One Pendrive 4GB or More (Let’s call it as Main USB drive/Pendrive).
  2. One more Pen drive or DVD disk to use as bootable Linux installation media.
  3. Linux OS ISO file, for example Lubuntu 18.04.
  4. One PC (Warning: Disconnect internal hard drives to prevent boot record alteration).

Important: While this procedure will not cause loss of data, some users have experienced changes to their internal drive’s bootup behavior depending on Linux distributions selected. To prevent any possibility of this occurrence, you may wish to disconnect your hard drive before continuing with the USB install portion of the tutorial.”

TIP: Use 32 bit Linux OS to make it compatible with any available PC.

That’s it! Go, and collect all of these. It’s time to do something new.

Step 1: Create Bootable Linux Installation Media

Use your Linux ISO image file to create a bootable USB installation media. You can use any software like Unetbootin, Gnome Disk Utility, Yumi Multi Boot, xboot, Live USB Creator, etc. to create bootable USB with the help of ISO image file.

Alternatively, you can use DVD disk by writing that ISO image to it (but that is the old school method).

Step 2: Create Partitions On Main USB Drive

You have to make two partitions on your Main USB drive using Gparted or Gnome Disk Utility, etc.

  • The root partition of format ext4 of size according to your use.
  • Optionally you can use the rest of the space as a FAT partition for using it as a normal USB drive.

I am having 16GB USB drive and I have created one root partition of 5GB and using rest 11GB as normal FAT partition. So my 16 GB USB drive is converted to 11GB drive for normal use on any PC. Sounds good.

This step you can do while installing Linux also, but it will be very complex while installing Operating Systems like Arch Linux.

Main USB Drive Partitions

Once you have created required partitions on the Main USB drive. Now take a deep breath because it’s time to go for Linux installation section.

Читайте также:  Режим восстановления mac os не работает

Step 3: Install Linux on USB Drive

1. First, boot Linux OS (Lubuntu 18.04) from your bootable installation media and launch installation application from a live session. Live session of Lubuntu 18.04 will look like this.

Lubuntu Live Boot

2. Installer welcome screen will appear, select Language there and hit Continue.

Select Lubuntu Installation Language

3. Select Keyboard Layout and continue…

Select Lubuntu Keyboard Layout

4. Select Wifi internet if you want to update Lubuntu while installation. I will skip it.

Select Wifi to Update Lubuntu

5. Select Installation Type and Third-party installation as per your choice and go to next..

Select Lubuntu Software Updates

6. Here select Something Else Option (It is Mandatory) and go to next…

Select Lubuntu Installation Type

7. This is an Important step, here you need to find out where your Main USB drive is mounted.

Find Main USB Drive

In my case /dev/sda are an internal hard disk of the PC and I am using /dev/sdb is USB Lubuntu Installation media from where this live session is booted.

And /dev/sdc is my Main USB drive where I want to install my Linux system and where I have made two partitions in step number 2. If you have skipped step 2, you can also make partitions in this window.

First, change the mount point of the first partition on this Main USB drive to ROOT (i.e. “ / ” ). And as shown in the second red square select bootloader installation device as the Main USB drive.

In my case it is /dev/sdc . This is the most important step in this tutorial. If it is not done correctly your system will boot only on the current PC you are using, which is exactly opposite of your motivation to follow this tutorial.

Once it is completed, double-check it and hit continue. You will get a small window showing devices and drive which will be affected.

8. Make sure that the device and drives shown on this window are of your Main USB drive, which is in my case /dev/sdc . Hit continue

Write Partition Changes to Disk

9. Now select your Region and hit Continue

Select Lubuntu Region

10. Add username, password, and hostname, etc…

Create a Lubuntu User

11. Let the installation finish.

Lubuntu Installation

12. After completing installation hit restart and remove your installation media and press Enter.

Lubuntu Installation Completes

13. Congratulations, you have successfully installed your own Linux OS on your pen drive to use it on any PC. Now you can connect a USB drive to any PC and start your system on that PC by simply selecting boot from USB option while booting.

Step 4: Customize the Lubuntu System

Now it’s time for fun. Just boot your system on any PC and start customizing. You can install any software you want. You can change Themes, Icon themes, install docker.

You can add and store your online accounts on it. Install/modify/customize whatever you want. All the changes will be permanent. They will not change or reset after rebooting or booting on other PCs.

The following figure shows my customized Lubuntu 18.04.

Lubuntu Running on USB Drive

The main advantage of this method is you can use your personal stuff, your online accounts securely on any PC. You can even do secure online transactions as well on any available PC.

I hope it will be helpful for you, if you have questions regarding this article, please feel free to ask in the comment section below.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

We are thankful for your never ending support.

Источник

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