1. First put Ubuntu shutdown.
2. Click on the menu in VMware vm-->settings
3. In hardware, click the Add button below and choose hard disk-->next-->next-->disk size (GB) is the size of the new drive-->next-->finish--> Ok. This will have a hard Disk 2 in VMware's devices.
Third, the next step is to go into Ubuntu and mount the new hard drive in.
1.
[email protected]: ~# fdisk-l
disk/dev/sda:17.1 GB, 17179869184 bytes
255 heads, Sectors/track, 2088 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Disk IDENTIFIER:0X000AF2A2
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 993 7976241 Linux
/dev/sda2 994 1044 409657+ 5 Extended
/dev/sda5 994 1044 409626, Linux Swap/solaris
disk/dev/sdb:8589 MB, 8589934592 bytes
255 heads, Sectors/track, 1044 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Disk identifier:0x00000000
Disk/dev/sdb doesn ' t contain a valid partition table
You can see one more/dev/sdb.
2.
Here is the format of the Ext3 file system
[email protected]: ~# mkfs-t ext3/dev/sdb
MKE2FS 1.40.8 (13-mar-2008)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) Y//The whole new hardware is formatted, not partitioned.
Filesystem label=
OS Type:linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
524288 inodes, 2097152 blocks
104857 blocks (5.00%) reserved for the Super user
First Data block=0
Maximum filesystem blocks=2147483648
Block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Writing Inode Tables:done
Creating Journal (32768 blocks): Done
Writing superblocks and filesystem accounting Information:done
This filesystem would be automatically checked every mounts or
Whichever comes first. Use Tune2fs-c or-i to override.
[email protected]: ~#
3.
[email protected]: ~# cd/home
[email protected]:/Home # mkdir work
[email protected]:/Home # MOUNT/DEV/SDB work//drive mount to work directory.
[email protected]:/Home # CD work
[email protected]:/home/work# ls
Lost+found
4.
Check the Mount status with the DF command
[email protected]: ~# DF
Filesystem 1k-blocks used Available use% mounted on
/DEV/SDA1 7913216 7803524 0 100%/
Varrun 257788 257548 1%/var/run
Varlock 257788 0 257788 0%/var/lock
Udev 257788 257740 1%/dev
Devshm 257788 257744 1%/DEV/SHM
LRM 257788 39760 218028 16%/lib/modules/2.6.24-19-generic/volatile
/dev/sdb 8322488 149632 7753428 2%/home/work
Gvfs-fuse-daemon 7913216 7803524 0 100%/root/.gvfs
See/dev/sdb 8322488 149632 7753428 2%/home/work
One, visible success.
5. Implement automatic mount on startup.
[email protected]: ~# gedit/etc/fstab
According to the following format
# <file system> <mount point> <type> <options> <dump> <pass>
We add by ourselves:
/dev/sdb/home/work ext3 defaults 0 0
Reboot so you can complete all the steps to add the hard drive.
3 , and a new disk partition.
1), fdisk command: fdisk–l
Printing the current disk partition table, we can see that the total amount of disk has actually increased to 4GB, but the partition has only the previous partitions.
2), type command:FDISK/DEV/SDA
"SDA is a hard disk that has been expanded to the SCSI hard disk, the IDE type hard disk corresponds to HDA, is the operation of the hard disk"
Type: m
List the Help for Fdisk
3), we are here to add a new partition, the area will be expanded to make a new partition, so that the operating system Mount recognition.
Type: n
Command N to add a new partition
4), at this point,fdisk will let you choose to add the logical partition (numbering starting from 5) or the primary partition (numbers 1 to 4). Select the primary partition, type P, and select logical partition to Type L. We select the primary partition so that:
Type: p
Select Create Primary partition
5), at this time,fdisk will let you select the primary partition number, if you already have the primary partition Sda1,sda2, then the number is selected 3, that is to create the partition is Sda3.
Type: 3
6), at this time,fdisk will let you choose the starting value of the partition this is the start value of the partition (start cylinder); it is best to press ENTER directly, if you enter a non-default number, it can cause wasted space.
At this point, type:w
Save all and exit, partition complete
4 , you can't use the disk now, you need to format it.
To format the newly added partition:
Type: Mkfs-t Ext3/dev/sda3
or MKFS.EXT3/DEV/SDA3 format the specified partition, and so on, the system is mostly in ext3 format, and if you need anything else, you can see MKFS's help.
5 , mount the partition:
To mount manually, type:mount/dev/sda3/home/work/
Indicates that the new partition is attached to /home/work/under this directory "
Boot automatically mount, then modify the /etc/fstab file, add a line in this file:
/dev/sda3/home/work ext3 defaults, 0 1
About the format of the file, later write the article discussion
Each time you boot, the partition will be hung under the big work directory.
You can use the new plus partition here.
fdisk Partitioning Example
FDISK is a disk partitioning tool under Linux that can partition disks into several zones and also specify file systems for each partition, such as Linux, FAT32, Linux, Linux swap, FAT16 format, etc.
Of course, after we use FDISK to partition the disk, we also use the MKFS command to format the partition in order to mount the use.
The representation of a hard disk partition:
In Linux is represented by hd*x or sd*x, where "*" represents a, B, C, etc., x represents the number 1, 2, 3, etc.; HD is the IDE hard disk; SD is SCSI or Removable Storage.
Start
The representation of a partition starting from X cylinder (magnetic column);
End
Represents a partition to the end of the Y cylinder (magnetic column);
Id,system
Represents the partition type, which is specified by specifying the ID to confirm the partition type in Fdisk.
Blocks
The capacity of the partition.
Fdisk-l
# fdisk-l
Disk/DEV/HDA:120.0GB, 120034123776 bytes
units = cylinders of 16065 * 512 = 8225280 BYTES
device Boot Start End Blocks Id system
/ DEV/HDA1 * 1 829 6658911 b W95 fat32
/dev/hda2 830 14593 110559330 f W95 Ext ' d (LBA)
/DEV/HDA5 830 3506 21502971 7 hpfs/ntfs
/dev/hda6 3507 4811 10482381 Linux
/dev/hda7 4812 4942 1052226: Linux swap
/dev/hda8 4943 6217 10241406 Linux
...
The "fdisk–l" can be used to view the hard disk and partition of the machine. The drive is 120G, has 255 magnetic surfaces, 63 sectors, 9,729 cylinders, and the capacity of each cylinder (cylinder) is 8225280 bytes. HDA has two primary partitions (including extended partitions), which are primary partitions hda1 and HDA2 (extended partitions), and HDA5 are logical partitions later. The total capacity of the hard disk is the primary partition (including the extended partition), and the extended partition is the sum of the total logical partition capacity. So, through the above example, we can learn hda=hda1+hda2, which hda3=hda5+hda6+hda7+hda8+ ....
Fdisk Interactive Partitioning operation
We take/DEV/SDA equipment as an example to explain how to use Fdisk to manipulate the addition, deletion of partitions and other actions.
#FDISK/DEV/SDA
Command (M for help): M
Command Action
A toggle a bootable flag
b Edit BSD Disklabel
C Toggle the DOS compatibility flag
d Delete a partition//delete a partition
L list known partition types//list partition type
M Print this menu//list Help information
n Add a new partition//Add a partition
o Create a new empty DOS partition table
P Print the partition table//list partition table
Q Quit without saving changes//Do not save exit
s create a new empty Sun Disklabel
t change a partition ' s system ID//changing partition type
U Change display/entry units
V Verify the partition table
W Write table to disk and exit//write partition table to hard disk and exit
X Extra functionality (experts only)//extended function
"Example" to SDA add two 200M primary partition, the other is extended partition, add two 200M logical partition in the extended partition;
Command (M for help): N
E Extended
P primary partition (1-4)
P
Partition number (1-4): 1
First cylinder (1-125, default 1):
Using Default value 1
Last cylinder or +size or +sizem or +sizek (1-125, default): +200m
Command (M for help): N
E Extended
P primary partition (1-4)
P
Partition number (1-4): 2
First cylinder (26-125, default 26):
Using Default Value 26
Last cylinder or +size or +sizem or +sizek (26-125, default): +200m
Command (M for help): N
E Extended
P primary partition (1-4)
E
Partition number (1-4): 3
First cylinder (51-125, default 51):
Using Default Value 51
Last cylinder or +size or +sizem or +sizek (51-125, default 125):
Using Default Value 125
Command (M for help): N
L logical (5 or over)
P primary partition (1-4)
L
First cylinder (51-125, default 51):
Using Default Value 51
Last cylinder or +size or +sizem or +sizek (51-125, default): +200m
Command (M for help): N
L logical (5 or over)
P primary partition (1-4)
L
First cylinder (76-125, default 76):
Using Default Value 76
Last cylinder or +size or +sizem or +sizek (76-125, default): +200m
Command (M for help):p
disk/dev/sda:1035 MB, 1035730944 bytes
Heads, Sectors/track, cylinders
Units = Cylinders of 16128 * 8257536 bytes
Device Boot Start End Blocks Id System
/DEV/SDA1 1 201568+ Linux
/dev/sda2 201600 Linux
/dev/sda3 604800 5 Extended
/dev/sda5 201568+ Linux
/dev/sda6 201568+ Linux
The partition type is then changed according to the t instruction, and the last W saves the exit.
The process of partitioning is normal:
[Email protected]/]# fdisk-l
disk/dev/sda:21.4 GB, 21474836480 bytes
255 heads, Sectors/track, 2610 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 104391 Linux
/DEV/SDA2 650 5116702+ Linux
/dev/sda3 651 841 1534207+, Linux Swap/solaris
[Email protected]/]# FDISK/DEV/SDA
The number of cylinders for this disk was set to 2610.
There is nothing wrong with the, but this is larger than 1024,
And could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from the other OSs
(e.g., DOS fdisk, OS/2 fdisk)
Command (M for help): n
Command Action
E Extended
P primary partition (1-4)
P
Selected Partition 4
First cylinder (842-2610, default 842):
Using Default Value 842
Last cylinder or +size or +sizem or +sizek (842-2610, default 2610):
Using Default Value 2610
Command (M for help): W
The partition table has been altered!
Calling IOCTL () to re-read partition table.
Warning:re-reading the partition table failed with error 16:device or resource busy.
The kernel still uses the old table.
The new table is used at the next reboot.
Syncing disks.
To view it again, the partition is already zoned:
[Email protected]/]# fdisk-l
disk/dev/sda:21.4 GB, 21474836480 bytes
255 heads, Sectors/track, 2610 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 104391 Linux
/DEV/SDA2 650 5116702+ Linux
/dev/sda3 651 841 1534207+, Linux Swap/solaris
/DEV/SDA4 842 2610 14209492+-up Linux
But when formatting, the error:
[Email protected]/]# mkfs-t ext3/dev/sda4
MKE2FS 1.39 (29-may-2006)
Could not stat/dev/sda4---No such file or directory
The device apparently does not exist; Did you specify it correctly?
Workaround: Execute the next partprobe command
The partprobe is included in the RPM package of the parted. Partprobe can modify the partition table in the kernel, allowing kernel to reread the partitioned table. Therefore, you can use this command to create partitions and the system to recognize those partitions without restarting the machine.
To see if the command is installed:
[Email protected] dev]# Rpm-q parted
Parted-1.8.1-23.el5
Let's execute the command:
[Email protected] dev]# partprobe
Warning:unable to Open/dev/hdc read-write (read-only file system). /DEV/HDC has been opened read-only.
Then in the format, it's OK:
[Email protected] dev]# mkfs-t ext3/dev/sda4
MKE2FS 1.39 (29-may-2006)
Filesystem label=
OS Type:linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1778880 inodes, 3552373 blocks
177618 blocks (5.00%) reserved for the Super user
First Data block=0
Maximum filesystem blocks=3640655872
109 Block groups
32768 blocks per group, 32768 fragments per group
16320 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
Writing Inode Tables:done
Creating Journal (32768 blocks): Done
Writing superblocks and filesystem accounting Information:done
This filesystem would be automatically checked every mounts or
Whichever comes first. Use Tune2fs-c or-i to override.
For Linux hangs, refer to blog:
linux Header V3 DSA signature:nokey, key ID error Resolution starting with RPM version 4.1, the software package signature is checked when the package is installed or upgraded. If the signature check fails, you will see an error message that resembles the following:
Error:v3 DSA Signature:bad, key ID 0352860f
If it is a new, file-only signature for the header, you will see an error message that looks like this:
Error:header V3 DSA Signature:bad, key ID 0352860f
If you do not have the appropriate keys installed to verify your signature, the message will contain nokey, such as:
Warning:v3 DSA Signature:nokey, key ID 0352860f
There are times when installing the software with Yum under CentOS, you'll end up with a hint:
Reference
Warning:rpmts_HdrFromFdno:Header V3 DSA Signature:nokey, key id*****
This is due to yum installing the old version of the GPG keys, the solution is
Reference
RPM--import/etc/pki/rpm-gpg/rpm*
Hanging on the hard disk under Linux