Redhat Linux Hard Drive Mount method

Source: Internet
Author: User
Tags deprecated what file system dmesg

Redhat Linux Hard drive Mount Method!!!

Hard drive mount operation work steps:

1 , first look at the current machine has a few hard disks, view the command there are two kinds:

Command 1 : # fdisk–l

Command 2 : # DMESG | grep SD

--------------------------------------------------------------------------------------------------------------- --------

Columns such as: I operate

[[Email protected]%ancunkj ~]# fdisk-l #执行这条命令 See the information two disks 128.0GB and 160.0GB

#128.0 This disk has no partitions and the disk name is SDA. 160.0GB This disk was partitioned into two districts of/dev/sdb1 and/dev/sdb2.

disk/dev/sda:128.0 GB, 128035676160 bytes
255 heads, Sectors/track, 15566 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000

disk/dev/sdb:160.0 GB, 160000000000 bytes
255 heads, Sectors/track, 19452 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk IDENTIFIER:0X00001ABC

Device Boot Start End Blocks Id System
/DEV/SDB1 * 1 17848 143360000 Linux
/DEV/SDB2 17848 19453 12888064, Linux Swap/solaris
[[Email protected]%ancunkj ~]#

--------------------------------------------------------------------------------------------------------------- --------------------

Where: fdisk The command is described as follows:

fdisk Command Purpose: observe the physical use of the hard disk and split the hard disk.

fdisk How to use the command :
First, enter the Fdisk-l on the console to observe the physical use of the hard disk.

Second, enter the Fdisk /DEV/SDA(Specific disk name) on the console to enter the partition drive mode.

Ø Input m displays all the commands listed below.

Ø The input p shows the hard disk segmentation situation.

Ø input A sets the boot area of the hard drive.

Ø Enter N to set a new hard disk partition.

Ø input e-drive is [extended] partition (extend).

Ø input P hard disk is [primary] partition (primary).

Ø input T to change disk partition properties.

Ø Enter D to delete the hard disk partition properties.

Ø input Q End does not deposit the hard disk partition attribute.

Ø Enter W end and write to disk partition properties.

DMESG The command is described as follows:

function Description: Displays the boot information.
syntax:DMESG [-cn][-s]
Additional Note:the kernel will store the boot information in ring buffer. If you are too late to view the information, you can use DMESG to view it. The boot information is also stored in the/var/log directory, in the DMESG document.
Parameters
-C Clears the contents of the ring buffer after displaying the information.
-S pre-configured to 8196, just equal to the size of the ring buffer.
-N Configures the level of logging information.

2 , create a disk partition on the hard disk that you want to mount

The steps to create a disk partition are as follows:

# FDISK/DEV/SDB (Specific disk name)

--------------------------------------------------------------------------------------------------------------- --

For example: I operate

[[Email protected]%ancunkj ~]# FDISK/DEV/SDA #执行这条命令, I'm entering SDA this disk
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF Disklabel
Building a new DOS disklabel with disk identifier 0X6A674FD6.
Changes'll remain in memory only, until the decide to write them.
After that, of course, the previous content won ' t is recoverable.

Warning:invalid flag 0x0000 of partition Table 4 would be a corrected by W (rite)

Warning:dos-compatible mode is deprecated. It ' s strongly recommended to
Switch off the mode (command ' C ') and change display units to
Sectors (Command ' u ').

Command (M for help): N #这个命令是 Create a new partition

--------------------------------------------------------------------------------------------------------------

Enter Fdisk mode:

Command (M for Assist): M//view fdisk command Help

Command (M for help): N//Create new partition

Command Action:

E Extended//Enter E to create an extended partition

P primary partition (1-4)//input p to create the primary partition, here we select P

Partion Number (1-4): 1//First extended partition, up to 4 primary partitions on demand

First Cylinder (1-1014,default 1): 1//The number of disk blocks starting at the start of the primary partition, you can select a default value

Last Cylindet or +siza or +sizem or +sizek: +1024MB//Can be a number in megabytes or

With the number of disk blocks, here we enter +1024MB to indicate a partition size of 1G

This way we create a partition, and if you want to create more partitions, you can continue with the steps above. Save the partition with W after all partitions have been created.

Command (M for help): W

The partition table has been altered!

After saving, restart the server, you can use the #fdisk-l command to check the newly built partition, you can confirm the/DEV/SDB1 information in the returned results.

---------------------------------------------------------------------------------------------------------------

[Email protected]%ancunkj ~]# Shutdown-r now #重启服务器

[Email protected]%ancunkj ~]# ipmitool-i lan-uroot-padmin-h mon_cn9 Power status #查看启动状态

---------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------- ---------------

How to create a partition again, some places to note:

I operate

[Email protected]%ancunkj ~]# FDISK/DEV/SDA

Warning:dos-compatible mode is deprecated. It ' s strongly recommended to
Switch off the mode (command ' C ') and change display units to
Sectors (Command ' u ').

Command (M for help): N
Command Action
E Extended
P primary partition (1-4)
E
Partition number (1-4): 2 #这个地方要注意的 cannot be 1.
First cylinder (1025-15566, default 1025): 1025 #这个地方要注意的 default is 1025, cannot be 1024.
Last cylinder, +cylinders or +size{k,m,g} (1025-15566, default 15566): 1024MB
Value out of range.
Last cylinder, +cylinders or +size{k,m,g} (1025-15566, default 15566): 1025MB

Command (M for help): W
The partition table has been altered!

Calling IOCTL () to re-read partition table.
Syncing disks.
[Email protected]%ancunkj ~]# fdisk-l

disk/dev/sda:128.0 GB, 128035676160 bytes
255 heads, Sectors/track, 15566 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk Identifier:0x6a674fd6

Device Boot Start End Blocks Id System #这个就是两块盘创建 Information
/DEV/SDA1 1 1024x768 8225248+ Linux
/DEV/SDA2 1025 1025 8032+ 5 Extended

disk/dev/sdb:160.0 GB, 160000000000 bytes
255 heads, Sectors/track, 19452 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk IDENTIFIER:0X00001ABC

Device Boot Start End Blocks Id System
/DEV/SDB1 * 1 17848 143360000 Linux
/DEV/SDB2 17848 19453 12888064, Linux Swap/solaris
[[Email protected]%ancunkj ~]#

--------------------------------------------------------------------------------------------------------------- ----------------------

3 , format the partition to Mount

Use the following command to format the newly created partition as Ext3

# mkfs-t Ext3-c/DEV/SDB1

MKFS The command is described as follows:

function Description: set up various file systems.
syntax:mkfs [-vv][fs][-f < file system type >][device name] [number of blocks]
Note:MKFS itself does not perform the work of establishing a file system, but instead calls the relevant program to execute it.
Parameters:
FS Specifies the parameters when the file system is established.
-t< File System type > Specifies what file system to build.
-V Displays version information with detailed usage methods.
-V shows a brief use of the method.

4 , Mount Partition

After formatting we need to mount the partition, for example, as follows:

# Mkdir/test

# Mount/dev/sdb1/test

# DF//view with df command

Filesystem 1k-blocks used Available use% mounted on

/DEV/SDA1 101089 9463 86407 10%/boot

None 62988 0 62988 0%/dev/shm

/DEV/SDB1 485906 8239 452580 2%/test//New Mount Partition

In order to mount the new partition automatically each time the system starts, you need to modify the Vi/etc/fstab file to mount it automatically. Add the following line to the bottom of the file:

/dev/sdb1/test ext3 Defaults 1 2

This will automatically mount the partition each time the server is started.

This is the end of the hard drive mount work.

--------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------

mkdir The command is described as follows:

function: Create a directory (similar to the MD command under MSDOS).
  syntax: mkdir [ options] Dir-name

  Description: This command creates a directory named by Dir-name. The user who is required to create the directory has write permissions in the current directory (in the parent directory of Dir-name), and Dir-name cannot be a directory or file name that is already in the current directory.
Parameters:
-m set access permissions on the new directory. You can also set it with the chmod command.
-P can be a path name. At this point, if some directories in the path do not already exist, and with this option, the system will automatically set up those directories that do not yet exist, that is, multiple directories can be established at one time.

Mount The command is described as follows:

function: Loads the specified file system.

syntax:mount [-AFFHNRVVW] [-l< tag;] [-o< option;] [-t< file system type;] [device name] [load Point]

usage Note:mount can load the file system specified in the specified device into the Linux directory (that is, the mount point). You can write frequently used devices to file/etc/fastab so that the system automatically loads every time you start. The Mount loading device information is logged in the/etc/mtab file. When you uninstall a device by using the Umount command, the record is cleared.

Parameter description:

The content of the description is more, not recorded here.

Specific access to this site: http://blog.chinaunix.net/u1/55764/showart_1145424.html

DF The command is described as follows:

function: View the status information of Linux file system, show the capacity of each partition, usage, unused amount and mount point and other information.

syntax:df [Options] ... [File] ...

Parameter description:

-A,--all includes a file system of size 0 blocks
-B,--block-size= size block with specified < size > bytes
-H,--human-readable file system size in an easy-to-understand format (e.g. 1K 234M 2G)
-H,--si similar to-H, but takes 1000 of the time instead of 1024
-I,--inodes displays inode information instead of block usage
-K is--block-size=1k
-L,--local only displays the native file system
--no-sync No sync action (default) before getting usage data
-P,--portability using POSIX output format
--sync sync action before getting usage data
-T, the--type= type only prints the file system information for the specified < type >
-T,--print-type print file system type
-X, the--exclude-type= type only prints file system information that is not a specified < type >
-V (this option is not processed)
--HELP Display this help message and leave
--version display version information and leave

Common operations:

Df-k display information for each partition in kilobytes (KB)
Df-a Show all partitions include a partition of size 0
DF-T Show partition type EXT2 or EXT3, etc.

Redhat Linux Hard Drive Mount method

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.