Add a new hard disk to CentOS and set automatic mounting to a disk

Source: Internet
Author: User

Add a new hard disk to CentOS and set automatic mounting to a disk

[Root @ appserver ~] # Df-h/* view existing partitions */

Filesystem Size Used Avail Use % Mounted on

/Dev/mapper/vg_admin-lv_root 18G 2.0G 16G 12%/

Tmpfs 495 M 228 K 495 M 1%/dev/shm

/Dev/sda1 485 M 35 M 425 M 8%/boot

[Root @ appserver ~] # Fdisk-l/* view existing DISK */

Disk/dev/sda: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x0007b51c

Device Boot Start End Blocks Id System

/Dev/sda1*1 64 512000 83 Linux

Partition 1 does not end on cylinder boundary.

/Dev/sda2 64 2611 20458496 8e Linux LVM

Disk/dev/mapper/vg_admin-lv_root: 18.9 GB, 18865979392 bytes

255 heads, 63 sectors/track, 2293 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x00000000

Disk/dev/mapper/vg_admin-lv_swap: 2080 MB, 2080374784 bytes

255 heads, 63 sectors/track, 252 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x00000000

[Root @ appserver ~] # Fdisk/dev/sdb/* Open the fdisk partitioning tool to partition the disk. If a partition is used by default, you can also skip this step */

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

Building anewDOS disklabel with disk identifier 0x0000c68f0.

Changes will remain in memory only, until you decide to write them.

After that, of course, the previous content won't be recoverable.

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

WARNING: DOS-compatible mode is deprecated. It's stronugly recommended

Switch off the mode (command 'C') and change display units

Sectors (command 'U ').

Command (m for help): m

Command action

A toggle a bootable flag

B editbsddisklabel

C toggle the dos compatibilityflag

D delete a partition

L list known partition types

M print this menu

Nadda new partition

O create a new empty DOS partition table

P print the partition table

Q quit without saving changes

S create anewempty Sun disklabel

T change a partition's system id

U change display/entry units

V verify the partition table

W write table to disk and exit

X extra functionality (experts only)

Command (m for help): n

Command action

E extended

P primary partition (1-4)

E

Partition number (1-4): 1

First cylinder (1-416101, default 1 ):

Using default value 1

Last cylinder, + cylinders or + size {K, M, G} (1-416101, default 416101 ):

Using default value 416101

Command (m for help): w

The partition table has been altered!

Calling ioctl () to re-read partition table.

Syncing disks.

[Root @ appserver ~] # Fdisk-l

Disk/dev/sda: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x0007b51c

Device Boot Start End Blocks Id System

/Dev/sda1*1 64 512000 83 Linux

Partition 1 does not end on cylinder boundary.

/Dev/sda2 64 2611 20458496 8e Linux LVM

Disk/dev/sdb: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x26128f57

Device Boot Start End Blocks Id System

Disk/dev/mapper/vg_admin-lv_root: 18.9 GB, 18865979392 bytes

255 heads, 63 sectors/track, 2293 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x00000000

Disk/dev/mapper/vg_admin-lv_swap: 2080 MB, 2080374784 bytes

255 heads, 63 sectors/track, 252 cylinders

Units = cylinders of 16065*512 = 8225280 bytes

Sector size (logical/physical): 512 bytes/512 bytes

I/O size (minimum/optimal): 512 bytes/512 bytes

Disk identifier: 0x00000000

[Root @ appserver ~] # Mkfs-t ext4-c/dev/sdb/* Format disk partition */

Mke2fs 1.41.12 (17-May-2010)

/Dev/sdb is entire device, not just one partition!

Proceed anyway? (Y, n) y

Filesystem label =

OS type: Linux

Block size = 4096 (log = 2)

Fragment size = 4096 (log = 2)

Stride = 0 blocks, Stripe width = 0 blocks

1310720 inodes, 5242880 blocks

262144 blocks (5.00%) reserved for the super user

First data block = 0

Maximum filesystem blocks = 4294967296

160 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks:

32768,983 04, 163840,229 376, 294912,819 200, 884736,160 5632, 2654208,

4096000

Checking for bad blocks (read-only test): done

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 34 mounts or

180 days, whichever comes first. Use tune2fs-c or-I to override.

[Root @ appserver ~] # Df-h
File System capacity in use available % mount point

Filesystem Size Used Avail Use % Mounted on

/Dev/mapper/vg_admin-lv_root 18G 2.0G 16G 12%/

Tmpfs 495 M 224 K 495 M 1%/dev/shm

/Dev/sda1 485 M 35 M 425 M 8%/boot


[Root @ appserver ~] # Mount/dev/sdb/home/admin/storage20 // * mount/dev/sdb to/home/admin/storage20 /*/
[Root @ appserver ~] # Df-h

Filesystem Size Used Avail Use % Mounted on

/Dev/mapper/vg_admin-lv_root 18G 2.0G 16G 12%/

Tmpfs 495 M 224 K 495 M 1%/dev/shm

/Dev/sda1 485 M 35 M 425 M 8%/boot

/Dev/sdb 20G 172 M 19G 1%/home/admin/storage20

[Root @ appserver ~] # Vi/etc/fstab

#/Etc/fstab

# Created by anaconda on Wed Mar 14 09:30:48 2012

#

# Accessible filesystems, by reference, are maintained under '/dev/disk'

# See man pages fstab (5), findfs (8), mount (8) and/or blkid (8) for more info

#

UUID = a779e5e4-e34a-4a96-b01a-dbc5cc348958/ext4 ults 1 1

Tmpfs/dev/shm tmpfs defaults 0 0

Devpts/dev/pts devpts gid = 5, mode = 620 0 0

Sysfs/sys sysfs defaults 0 0

Proc/proc defaults 0 0

/Dev/sdb/home/admin/storage20 ext4 defaults 0 0/

* After restart,/dev/vdb is automatically mounted to the/mnt directory */


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.