Two Representation Methods for storing devices in Linux (4)

Source: Internet
Author: User

The following describes the two Representation Methods of the storage device in Linux. It is okay to send it out. I hope it will be helpful to some users who do not understand it. You can skip this step.

4. Application of different representation methods of storage devices;

1./dev/hd [a-z] indicates the application of the method.

1) used to mount a file system partition;

As we mentioned earlier, the hard disk partition/dev/hd [a-z] X representation method is generally used to mount and read file systems;

 
 
  1. [root@localhost ~]# fdisk -l  
  2.  
  3. Disk /dev/hda: 80.0 GB, 80026361856 bytes  
  4. 255 heads, 63 sectors/track, 9729 cylinders  
  5. Units = cylinders of 16065 * 512 = 8225280 bytes  
  6.  
  7. Device Boot      Start         End      Blocks   Id  System  
  8. /dev/hda1   *           1         970     7791493+   7  HPFS/NTFS  
  9. /dev/hda2             971        9729    70356667+   5  Extended  
  10. /dev/hda5             971        2915    15623181    b  W95 FAT32  
  11. /dev/hda6            2916        4131     9767488+  83  Linux  
  12. /dev/hda7            4132        5590    11719386   83  Linux  
  13. /dev/hda8            5591        6806     9767488+  83  Linux  
  14. /dev/hda9            6807        9657    22900626   83  Linux  
  15. /dev/hda10           9658        9729      578308+  82  Linux swap / Solaris 

For example, if I want to mount/dev/hda9 to the system, the process should be like this;

[Root @ localhost ~] # Mkdir/opt/data/Note: Create a mount point directory;
[Root @ localhost ~] # Mount/dev/hda9/opt/data/Note: mount;

Is it mounted? Check the following information and check that the file has been mounted. Therefore, we can write to the/opt/data directory, and all the written content is recorded on/dev/hda9;

[Root @ localhost ~] # Df-lh
Filesystem capacity in use available % mount point
/Dev/hda7 11G 9.2G 1.1G 90%/
/Dev/shm 236 M 0 236 M 0%/dev/shm
/Dev/hda9 22G 3.9G 18G 18%/opt/data

Note:Kernel support is required for mounting, and a file system must be created for partitions. For more information, see related documents;

2) It is used to specify the location of the Linux Root partition in GRUB;
In the GRUB System Boot manager, you must specify the Linux Root/hard disk partition/dev/hd [a-z] X when starting an operating system using the command line; for example, root =/dev/hda7;

2. hd [0-n] indicates the application of the method;
This is generally applied to the specified hard disk partition where GRUB/boot is located; it must be applied to the GRUB command line and GRUB configuration file menu. lst;

For example, if you want to write GRUB to the hard disk MBR, you must specify GRUB through root (hd [0-n], y) in the GRUB command line mode; here, root (hd [0-n], y) is the partition where/boot is located in GRUB. Do not make a mistake, sometimes, the root/of/boot and Linux are not in the same partition. It depends on how you install Linux; the preceding root =/dev/hd [a-z] X specifies the partition where the Linux root/is located. Although sometimes/boot AND/are in the same partition, however, the two methods have their own purposes in GRUB;

For example, if/boot is located in the same hard disk partition, you can use a similar method to write GRUB to the hard disk MBR. For example;

 
 
  1. [Root @ localhost ~] # Grub Note: Run GRUB;
  2.  
  3. Grub> root (hd0, 6) Note: for example, if/boot is located in the (hd0, 6) partition, it should be as follows:
  4. Filesystem type is ext2fs, partition type 0x83
  5.  
  6. Grub> setup (hd0)
  7. Checking if "/boot/grub/stage1" exists... yes
  8. Checking if "/boot/grub/stage2" exists... yes
  9. Checking if "/boot/grub/e2fs_stage1_5" exists... yes
  10. Running "embed/boot/grub/e2fs_stage00005 (hd0)"... 15 sectors are embedded.
  11. Succeeded
  12. Running "install/boot/grub/stage1 (hd0) (hd0) 1 + 15 p (hd0, 6)/boot/grub/stage2
  13. /Boot/grub. conf "... succeeded
  14. Done.
Grub> quit Note: exit the GRUB command line mode;

If you don't understand it, it will take a while. I am only writing for the application. If you want to understand why Linux storage devices express this or that, we recommend that you check the kernel document. Chinese documents may not meet your needs. It is best to look at foreign documents;

I hope that the "Two Representation Methods for storing devices in Linux" will be helpful to you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.