Linux Virtual Machine hard drive (1)

Source: Internet
Author: User

I. Hard Disk identification in Linux

After 2.6 kernel, linux will create the corresponding device file under/dev/on the recognized hardware device. For example:

Sda represents 1st SCSI hard disks.

Hda indicates 1st IDE Hard Disks (connected to the Master port of 1st IDE interfaces ).

1st USB optical drives.

After a new hard disk is added, the corresponding device files are generated in the/dev directory. The cciss hard disk is an exception.

The device file is in the/dev/cciss/directory. Generally, the "fdisk-l" command can be used to list the hard disks currently connected to the system.

Device and partition information. If the new hard disk does not have partition information, only the disk size information is displayed.

2. Add a new hard disk in linux

The following describes how to add a 10 Gb hard disk to the Slave interface of the first IDE port on GTES 11.

After the hard disk is installed, boot it to Turbolinux. Log On As root.

Run the fdisk-l command to display the hard disk devices of the current system.

[Root @ g11-64-1 ~] # Fdisk-l

Disk/dev/hda: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Device Boot Start End Blocks Id System

/Dev/hda1*1 13 104391 83 Linux

/Dev/hda2 14 89 610470 82 Linux swap/Solaris

/Dev/hda3 90 2610 20249932 + 83 Linux

Disk/dev/hdb: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Disk/dev/hdb doesn't contain a valid partition table

[Root @ g11-64-1 ~] #

No partition information is displayed for hdb. The size is 10 Gb.

Use the fdisk command to partition hdb.

[Root @ g11-64-1 ~] # Fdisk/dev/hdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel. Changes will remain in memory only,

Until you decide to write them. After that, of course, the previous

Content won't be recoverable.

The number of cylinders for this disk is set to 1305.

There is nothing wrong with that, but this is larger than 1024,

And coshould in certain setups cause problems:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

(E.g., dos fdisk, OS/2 FDISK)

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w (rite)

Input: n indicates creating a partition.

Command (m for help): n

Command action

E extended

P primary partition (1-4)

Input: p indicates creating an original partition.

P

Partition number (1-4): 1

Input: 1 indicates that the partition number is 1.

First cylinder (1-1305, default 1 ):

Input: Press enter to use the default start cylindrical number.

Using default value 1

Last cylinder or + size or + sizeM or + sizeK (1-1305, default 1305 ):

Enter: Press enter to use the default ending cylinder number. That is, the partition uses the entire hard disk space.

Using default value 1305

Command (m for help): w

Input: w disk storage, exit fdisk.

The partition table has been altered!

Calling ioctl () to re-read partition table.

Syncing disks.

Run the fdisk-l command to view the partition information.

[Root @ g11-64-1 ~] # Fdisk-l

Disk/dev/hda: 21.4 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Device Boot Start End Blocks Id System


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.