This article is a mirror article of machine translation, please click here to jump to the original article.

View: 14680|Reply: 1

[linux] Installing Linux on a mobile hard drive: How to install Linux on a mobile drive

[Copy link]
Posted on 12/22/2014 10:53:22 PM | | |
Getting an external drive is an excellent way to breathe life into older devices or allow you to run Linux on a machine that can't (or don't want) to change the internal hard drive. Let's say you want to use Linux in a dual boot system, but you don't have any free space in your computer's hard drive. One solution is to use an "active" Linux distribution such as Knoppix, which can run directly from a CD. This method does work if used occasionally, but it has a number of serious drawbacks:
  
You still need some data files for permanence. If you only use very small files, you can use floppy disks; For medium-sized files, a USB flash drive may be sufficient, but none of them are ideal.
  
When using "active" CDs, it is very difficult or even impossible to install your own applications or customize existing ones.
  
Using an active distribution slows down performance, most notably when startup detects all devices - but also at runtime (because everything has to be loaded from a CD, which is usually much slower than loading from a hard drive).
  
Naturally, there are other options. For example, you can buy other built-in drives and install Linux in them. But it's common for the machine to probably not have any drive bays available (even more so for laptops, which usually only allow one internal hard drive).
  
Alternatively, you can use a larger drive instead of your current one and install Linux in the extra space you get from it. However, this is a time-consuming option as it requires you to reinstall the existing OS system on the new drive, reinstall and reconfigure all applications, and restore all data.
  
A better solution is to buy an external hard drive and install Linux in it. This allows you to connect external drives only when you want to use Linux without changing your existing hardware and software.
  
  Removable drive options
  
The range of mobile devices that can install Linux in them ranges from floppy disk drives to USB flash devices to USB/FireWire hard drives and more.
  
While it is true that Linux may be installed in small capacity devices such as 1.44MB floppy disks or 32MB USB disks, these are often (necessarily) specialized scaled-down distributions, for example, to rescue damaged installations.
  
However, external hard drives offer the most flexibility for a general-purpose Linux distribution at a reasonable cost.
  
External drives come from many different manufacturers (Maxtor, Western Digital, etc.) and can come in a variety of different sizes. These drives all contain an external box that holds standard 3-1/2" or 2-1/2" IDE drives. These drives are usually connected to the computer via USB or IEEE1394 (FireWire).
  
There are two main versions of USB, 1.1 and 2.0. Version 1.1 has a maximum transfer speed of 12 Mbit/s (megabits per second), while version 2.0 supports transfer speeds of up to 480 Mbit/s. While most 2.0-compatible drives are backwards compatible with 1.1, it's generally best to avoid 1.1 unless you have no other choice (because it's slower).
  
The FireWire standard also defines many different possible speeds, but in reality, whenever people talk about FireWire, they mean "FireWire400", which supports transmissions up to 400 Mbit/s.
  
In terms of speed, there is not much to choose between USB 2.0 and FireWire: while USB 2.0 reports higher speeds, they are actually similar because of the differences. If your computer has both, it may be better to use USB instead of FireWire (I'll explain why later), but if you only have FireWire, you can of course only choose FireWire. For maximum flexibility, choose from a large number of drives that support USB 2.0 and FireWire (say, the one I'll use later in this article).
  
FireWire and USB 2.0 cards are cheap for computers that don't have the required ports, PCI (for desktops) and PCMCIA (for laptops): for example, the PCMCIA FireWire card I used later in this article was about 10GBP (less than $20).
  
To finish this article, I purchased a 5-1/4" external drive box. This is a very flexible pendant that does not come with any drive and can fit into any standard IDE device, including 3-1/2" hard drives and 5-1/4" IDE devices such as CD-RW/DVD-RW drives. The enclosure has USB 2.0 and FireWire connectivity.
  
To connect the platter box to my IBM Thinkpad T30 laptop, I also purchased a PCMCIA FireWire card (the built-in USB port only supports USB 1.1).
  
Both the cartridge and FireWire card are cheaper (50GBP and 10GBP respectively).
  
For testing purposes, I connected the platter box with the 13GB 3-1/2" IDE drive I prepared - in actual use, I would buy larger capacity drives, which are now also very cheap (about 50GBP per GB!). )
  
  Linux support
  
As you might expect, Linux support for these trays is really good. Any device that adheres to the SBP (Serial Bus Protocol) standard for "high-volume devices" can be easily used with Linux.
  
In general, to enable support for these devices, the kernel needs to support a lot of things (either directly compiled or via modules).
  
For both USB and FireWire, SBP device support is implemented via SCSI emulation - i.e., devices are displayed to Linux as if they were SCSI disks. This is a common way to abstract storage devices in Linux (e.g., IDE CD/DVD drives are also commonly connected using SCSI emulation). Therefore, the following kernel support is required:
  
* SCSI support
  
* SCSI simulation
  
* SCSI disk support
  
In addition, depending on the connection method, the following support may be required:
  
For FireWire:
  
IEEE1394 support
  
OHCI1394 support
  
RAW1394 support
  
SBP-2 supported
  
For USB:
  
(Host) USB support
  
OHCI support
  
UHCI support
  
USB mass storage support
  
Obviously, you have to support other hardware (graphics card, etc.) completely normally, and depending on your actual hardware situation, you may need some other modules.
  
For example, I use a PCMCIA (cardbus) FireWire card, so I need to add:
  
PCMCIA support
  
cardbus support
  
  Installation
  
Now that we have an external device, we will start installing Linux in it.
  
The easiest way to install Linux right now (in my opinion, of course) is to connect all the hardware (here, that includes plugging in the PCMCIA FireWire card, connecting the FireWire cable to the PCMCIA card and the drive, and turning on the drive's power switch); Then boot the computer with the installation CD of your chosen distribution.
  
The distro I chose was Gentoo (see references for related links), so I used the latest "Universal" x86 Live CD (2004.1). Other distributions should require more or fewer steps than those described here.
  
Once booted with the installation CD, it should have recognized your drive if you're lucky. The drive should appear as a disk under /dev/sdX, where X is a lowercase letter starting with "a". In my system, the external drive is detected as /dev/sda, but if you have other SCSI disks (simulated SCSI disks), this changes; In that case, it could be /dev/sdb or some other letter. If the drive is not automatically detected, further steps may be required - for example, you may have to enable FireWire or PCMCIA via the boot option, or you may have to manually load some kernel modules or something else like that (see the reference for a link to the troubleshooting guide).
  
Once the drive has been identified, it should indeed function like an internal hard drive for the rest of the installation to be considered; So you should be able to partition it as needed and install Linux as usual.
  
A word of caution, though: be careful when deciding where to install the bootloader (usually GRUB or LILO) - I recommend not installing it in a Master Boot Record (MBR), which is usually the default. Instead, it should be installed in the root partition (or boot partition, if using a separate bootloader) of the external drive.
  
Now that we have Linux installed in the device, let's boot Linux. There are some tips to start from here.
  
  Guidance
  
Before discussing booting a new drive, there are some bootloader theories to understand.
  
The bootloader is usually installed in the MBR of the computer's first hard drive. When the bootloader is invoked (the BIOS automatically executes the code in the MBR), it usually displays a menu of OS that can boot. Select a given OS boot.
  
There are two things to note about this scenario:
  
* OS selection menu (usually) loaded from disk.
  
* To boot the OS, the bootloader needs to read the relevant kernel from disk.
  
Since the above happens before the OS is loaded, it means that all disk reads must occur in the way the BIOS calls are made. This involves serious problems: i.e. in order to boot the disk directly, your BIOS must support disks connected via FireWire or USB. This can often be seen as a BIOS option to boot from these types of disks. In fact, FireWire BIOS support is currently rare, but USB support is becoming fairly common. So if you're using USB in a relatively new computer, you should be able to boot the drive directly in Linux.
  
After installing GRUB in the MBR of an external drive, I can boot the drive directly when connected via USB. When booting the connected disk is simply entering the BIOS setup program. The external disk will appear as a normal hard drive: move the disk so that it precedes the internal drive in the boot order.
  
I can also install the bootloader in the MBR of the internal drive and use it to boot the USB drive (at this point it shows up as hd1 in GRUB in GRUB). If you are using FireWire, there is a chance that the BIOS cannot boot the drive directly and will require some additional actions.
  
Luckily, because of the flexibility of Linux, if you can't boot directly (with a PCMCIA FireWire card, that's definitely my case!). ), there will be fairly simple solutions. The initial boot steps can be performed from a supported device such as a floppy disk drive, CD, USB key, or tiny partition on the primary drive, and then additional operations can be performed using the external drive.
  
Build a boot image
  
Bootstrapping can be done using two methods:
  
* One-stage guidance
  
The kernel boots, installs the root filesystem, and continues with initialization by calling an initialization script (usually /sbin/init).
  
* Two-stage (initrd) bootstrapping
  
The kernel boots, installs the initial RAM disk (initrd), and performs further customizable initialization, and then install the root filesystem and proceed with initialization (usually also by calling /sbin/init) Both methods have their own advantages and disadvantages.
  
One stage of guidance
  
In order to use one-stage boot, we need to build a kernel that has all the drivers needed to install the built-in root file system




Previous:Commands and methods to properly shut down your Linux computer
Next:linuxroot login: A method to restrict the login of the root user under the Linux operating system
Posted on 12/27/2014 4:13:43 PM |
mark Mark learned, this time you can not do it
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com