Introduction to the sda * hard drive partition device number in Ubuntu

Source: Internet
Author: User
First, basic knowledge is required: FROM disk partition basics and hardware partition device number on LINUX ================================ ================ now let's start talking about partitions, first, clarify the concept: primary partition: a part of a physical hard disk that can be used independently.

First, basic knowledge is required: FROM disk partition basics and hardware disk partition device number on LINUX

========================================================== ===

Now let's talk about Partitions. First, let's clarify the concept:

Primary Partition: A part of a physical hard disk that can be used independently. a hard disk can have up to four primary partitions.
Extended partition: to break through the limit that a physical hard disk can have only four partitions, an extended partition is introduced. Extended partitions are equivalent to primary partitions, but they cannot be directly used. However, they can be further divided into multiple logical partitions.
Logical Partition: A logical partition can have any number of partitions, but cannot exist independently. multiple consecutive logical partitions can be used as an extended partition. One hard disk can only have one extended partition.
Summary: In other words, there are still up to four primary partitions and extended partitions on a physical hard disk. However, extended partitions can be further divided into logical partitions. for most users, there is no difference in the use of primary and logical partitions. In this way, a fast hard disk can have almost unlimited partitions.

Partition instance analysis in LINUX:
Now there is a SCSI hard disk on the computer. check the device.
Ls/dev
There will be an sda. if it is an IDE hard disk, it is hda.

Partition scheme 1: 4 primary partitions
At this time, we can see: sda, sda1, sda2, sda3, dsa4

Partition scheme 2: one primary partition and one logical partition
At this time, we can see: sda, sda1, sda2, sda5
Here, sda is a physical hard disk, sda1 is a primary partition, sda2 is an extended partition, and sda5 is a logical partition (because four numbers must be reserved for the primary partition and extended partition, therefore, the number of the logical partition must start from 5 ).

Partition scheme 3: one logical partition
Here we can see: sda, sda1, sda5
Don't be afraid to see these numbers. it's easy to understand this explanation. If multiple physical hard disks exist, sdb and sdc may occur.

Partition number 1234 is allocated in the order of creation time, and logical partitions are allocated by the partition location on the hard disk.

========================================================== =====

Author: Easiny

========================================================== ====================================

In my Ubuntu system, there are a total of sda *

Ubuntu @ ubuntu-desktop:/media $ ll/dev | grep sda
Brw-rw ---- 1 root disk 8, 0 2009-12-1901: 32 sda // hard disk
Brw-rw ---- 1 root disk 8, 1 2009-12-1901: 32 sda1 // primary partition 1 is equivalent to C in Win:
Brw-rw ---- 1 root disk 8, 2 2009-12-1901: 32 sda2 // extended partition
Brw-rw ---- 1 root disk 8, 5 2009-12-1903: 29sda5 // Logical Partition 1 is equivalent to D in Win:
Brw-rw ---- 1 root disk 8, 6 2009-12-1903: 39 sda6 // Logical Partition 2 is equivalent to E in Win:
Brw-rw ---- 1 root disk 8, 7 2009-12-1901: 33 sda7 // mount point of Logical Partition 3 is/Directory
Brw-rw ---- 1 root disk 8, 8 2009-12-1901: 32 sda8 // Logic partition 4 no mount point is swap
Ubuntu @ ubuntu-desktop:/media $

==========================================================

Ubuntu @ ubuntu-desktop:/media $ fdisk-l
Cannot open/dev/sda
Ubuntu @ ubuntu-desktop:/media $ sudo fdisk-l // view sda information
Sudo: unable to resolve host yuanming

Disk/dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Disk identifier: 0xbf8db35e

Device Boot Start End Blocks Id System
/Dev/sda1*1 5099 40957686 c W95 FAT32 (LBA)
/Dev/sda2 5100 19457 115330635 f W95 Ext 'd (LBA)
/Dev/sda5 5100 10198 40957686 7 HPFS/NTFS
/Dev/sda6 10199 15297 40957686 7 HPFS/NTFS
/Dev/sda7*15298 19157 31005418 + 83 Linux
/Dev/sda8 19158 19457 2409718 + 82 Linux swap/Solaris
Ubuntu @ ubuntu-desktop:/media $

==========================================================

Sda5 AND sda6

I am a dual-system. In Ubuntu, I sometimes cannot open drive D and drive e. Therefore, it can only be manually mounted.

Ubuntu @ ubuntu-desktop:/media/sda6 $ sudo mount-t NTFS-3G/dev/sda6/media/sda6-o force // manually mount to the edisk
Sudo: unable to resolve host sin
$ LogFile indicates unclean shutdown (0, 0)
WARNING: Forced mount, reset $ LogFile.
Ubuntu @ ubuntu-desktop:/media/sda6 $ ls
Ubuntu @ ubuntu-desktop:/media/sda6 $ cd ..
Ubuntu @ ubuntu-desktop:/media $ ls
Cdrom cdrom0 disk sda6 sin
Ubuntu @ ubuntu-desktop:/media $ df
File System 1 K-block used available % mount point
/Dev/sda7 30518012 3923408 25044336 14%/
Tmpfs 516488 0 516488 0%/lib/init/rw
Varrun 516488 100 516388 1%/var/run
Varlock 516488 0 516488 0%/var/lock
Udev 516488 2740 513748 1%/dev
Tmpfs 516488 352 516136 1%/dev/shm
Lrm 516488 2204 514284 1%/lib/modules/2.6.27-14-generic/volatile
/Dev/sda1 40947648 31237152 9710496 77%/media/disk
/Dev/sda5 40957684 26918328 14039356 66%/media/sin // D disk that has been manually attached in advance
/Dev/sda6 40957684 39082404 1875280 96%/media/sda6
Ubuntu @ ubuntu-desktop:/media $

==========================================

Ubuntu @ ubuntu-desktop:/media $ cd sda6
Ubuntu @ ubuntu-desktop:/media/sda6 $ ls // The content of the edisk is displayed, indicating that the attachment is successful.
AutoRun. inf dotnet MaxBak System Volume Information microcontroller thesis and data Image Collection
BIOS exercise tools plus BIOS full manual Flash Microsoft online broadcast TCP-IP detailed Volume 1-3 disc image Japanese Wanfang Database
C ++ Folder. htt MS Press-Understanding IPv6 tecdocs assembly and network software Senior Documents
C java programmer must read: basic article MyDocuments UML Technology ebook software Qilu
Collection JAVA programmer must read: basic article .rar OpenGL VC computer .rar life ebook
Cowry-fl2k8c-cd1.avi.tmp Java deep adventure Opengll vod_cache_data courseware internship
Cowry-fl2k8c-cd2.avi.tmp Linux photoshop operating system concept sixth edition Liang Jingru-dare not when. vob. tmp data structure
C language library query. .exe manmonth?programfiles operating system concept version 7 Liang Jingru-children's song. vob. tmp database
Desktop. ini master.rar RECYCLER operating system is Redhat 9.0) Liang Jingru-love song. vob image
Ubuntu @ ubuntu-desktop:/media/sda6 $ cd ../sin

==========================================================

Sda7 AND sda8

View/etc/fstab information

Ubuntu @ ubuntu-desktop: $ cat/etc/fstab
#/Etc/fstab: static file system information.
#
#
Proc/proc defaults 0 0
#/Dev/sda7
UUID = e2fe617a-7404-4090-9449-a4360ac0c8ea/ext3 relatime, errors = remount-ro0 1
#/Dev/sda8
UUID = 051def70-70c8-46a5-ab50-ce2cf5b243f9 noneswap sw 0 0

========================================================== ======

Add a knowledge point: FROMFstab parameters

Fstab stores important information related to partitions. each row is a partition record, and each row can be divided into six parts, the following uses/dev/hda7/ext2defaults 1 as an example to describe one by one:

1. the first option is the actual location of the storage device you want to mount, such as hdb or/dev/hda7 in the above example.

2. the second item is the directory to which you want to add it, such as/home or/in the above example. this is the mount point prompted during installation.

3. the third item is the so-called localfilesystem, which contains the following formats: ext, ext2, msdos, iso9660, nfs, swap, etc., or ext2, for more information, see/prco/filesystems.

4. the fourth item is the status you want to set when you mount, such as ro (read-only) or the above example of ULTS (including other parameters such as rw, suid, exec, auto, nouser, and async), you can refer to "mountnfs 」.

5. the fifth item is to provide the DUMP function. it indicates whether the BACKUP flag is required during system DUMP. The value is 0.

6. the sixth item is to set whether the filesystem needs to perform the check action at startup. except for the root filesystem, the required check value is 1. the other items can be set as needed. the internal value is 0.

LABEL = // ext3 defaults 1 1
LABEL =/boot ext3 defaults 1 2
None/dev/pts devpts gid = 5, mode = 620 0 0
None/proc defaults 0 0
None/dev/shm tmpfs defaults 0 0
/Dev/hda11 swap defaults 0 0
/Dev/hda5/mnt/d vfat suid, exec, dev, rw, iocharset = gb2312, umask = 0 00
/Dev/hda6/mnt/e vfat suid, exec, dev, rw, iocharset = gb2312, umask = 0 00
/Dev/hda7/mnt/f vfat suid, exec, dev, rw, iocharset = gb2312, umask = 0 00
/Dev/hda8/mnt/g vfat suid, exec, dev, rw, iocharset = gb2312, umask = 0 00

Iocharset can be set to utf8.
Umask = 0. any user can read windows partitions.

Fstab file in Linux
1. functions of the fstab file
File/etc/fstab stores the file system information in the system. When the file is correctly set, you can run the "mount/directoryname" command to load a file system. each file system corresponds to an independent line, fields in each row are separated by spaces or tabs. At the same time, fsck, mount, umount and other commands all use this program.

2. fstab file format
The following is an example line of the/etc/fatab file:
Fs_spec fs_file fs_type fs_options fs_dump fs_pass
/Dev/hda1/ext2 defaults 1 1

Fs_spec-this field defines the device or remote file system where the file system to be loaded is located. for general local block devices, the IDE device is generally described as/dev/hdaXN, X is the channel (a, B, or c) of the IDE device. N represents the partition number. SCSI device 1 is described as/dev/sdaXN. For NFS, the format is generally:

For example, 'knuth. aeb. nl :/'. For procfs, use 'proc' for definition.

Fs_file-this field describes the directory point to be loaded by the file system. for a swap device, this field is none. for a directory name containing spaces, 40 is used to indicate spaces.

Fs_type-defines the file system on the device. the common file types are ext2 (common file types for Linux devices) and vfat (fat32 format for Windows systems), NTFS, iso9600, etc.

Codepage country code page

Iocharset character set

Fs_options-specifying the file system to load the device is a specific parameter option that needs to be used, multiple parameters are separated by commas. Most systems can use "defaults" to meet their needs. Other common options include:
Option description
Ro loads the file system in read-only mode
Sync does not buffer write operations on the device, which can prevent file system damage during abnormal shutdown, but reduces the computer speed.
User allows normal users to load the file system
Quota forces disk quota limit on this file system
Noauto no longer uses the mount-a command (for example, when the system is started) to load the file system

Fs_dump-This option is used by the "dump" command to check how often a file system should be dumped. If no dump is required, set this field to 0.

Fs_pass-this field is used by the fsck command to determine the sequence of the file system to be scanned at startup. The value of the "/" pair of the root file system should be 1, other file systems should be 2. If the file system does not need to scan at startup, set this field to 0.

3. Sample file
#/Etc/fstab
/Dev/hda8 swap defaults 0 0
/Dev/hda9/ext2 defaults 1 1
/Dev/hda6/wine vfat defaults, codepage = 936, iocharset = cp936 0 0
/Dev/hda7/winf vfat defaults, codepage = 936, iocharset = cp936 0 0
/Dev/hdb/cdrom iso9660 noauto, user 0 0
None/proc defaults 0 0
None/dev/pts devpts gid = 5, mode = 620 0 0

Common mkfs commands for formatting, such as mkfs. ext3, mkfs. msdos, and mkfs. vfat. for example, mkfs. ext3/dev/hdb1. The following describes how to use man mkfs.

========================================================== ================

The network information is referenced at the beginning and end. you can understand the network information in the middle. if any errors occur, correct them.

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.