How to add new hard drives to Linux

xiaoxiao2021-03-06  52

Connect the hard disk on the server, start Linux, log in to root.

For example, I add a SCSI hard disk, you need to divide it into three districts:

[Code: 1: 5C157E4B2E]

#fdisk / dev / sdb

Enter FDisk mode:

Command (M for Help): P // View the partition of the new hard drive

Command (M for Help): N // Create a new partition

You can use the m command to see the internal command of the fdisk command; n command creates a new partition; d Command Delete an existing partition; p command displays a list of partitions; t command modifies the type ID number of the partition; l Commands Displays a list of partition ID numbers The A command specifies the start partition; the W command is the modification store of the partition table to act.

Command action

e extended // Input E Create an extension partition

p Primary Partition (1-4) // Input P is to create a master partition, here we choose P

Partion Number (1-4): 1 // First expansion partition, according to your needs, you can get the most 4 primary partitions.

First cylinder (1-1014, default 1): 1 // Number of disk blocks started by the first primary partition

Last Cylindet OR Siza Or Sization OR SIZEK: 1024MB / / can be numbers in MB or

The number of disk blocks, here we enter 1024MB indicate that the partition size is 1G.

[/ code: 1: 5C157E4B2E]

This way we created a partition, if you want to create more partitions, you can continue to create on the steps above.

After the creation, use W to save the partition.

[Code: 1: 5C157E4B2E]

Command (M for Help): w

The partition Table Has Been Altered!

Calling ioctl () to re-read partition table.

Syncing disks.

[/ code: 1: 5C157E4B2E]

In this way, we must format it.

[Code: 1: 5C157E4B2E]

#mkfs -t ext3 -c / dev / sdb1 // If there are multiple partitions, the partition is modified to SDB2.

[/ code: 1: 5C157E4B2E]

After formatting, we need to mount partitions.

[Code: 1: 5C157E4B2E]

#mkdir www // Create / WWW directory, we will hang new partitions under WWW

#mount / dev / sdb1 / www // Mount / DEV / SDB1 to / WWW

# DF // View with DF commands

FileSystem 1K-block Used Available Use% MOUNTED ON

/ DEV / SDA2 3771316 1388956 2190788 39% /

/ DEV / SDA1 101089 9463 86407 10% / boot

NONE 62988 0 62988 0% / dev / shm

/ DEV / SDB1 485906 8239 452580 2% / www // See it, this is our just

Talented partition

[/ code: 1: 5C157E4B2E]

Here we work is close to the end, but if we end, we must restart the server every time we restart the server.

Make a manual mount, which is very troublesome, we need to modify the / etc / fstab file to automatically mount.

[CODE: 1: 5C157E4B2E] #VI / ETC / FSTAB

[/ code: 1: 5C157E4B2E]

Fix the following in the end of the file:

[Code: 1: 5C157E4B2E]

/ DEV / SDB1 / WWW EXT3 DEFAULTS 1 2

[/ code: 1: 5C157E4B2E]

If there are multiple partitions to modify SDB1 and / WWW, save the server after modification.

At this point, we have added a new hard drive.

转载请注明原文地址:https://www.9cbs.com/read-114917.html

New Post(0)