How to mount hard disk in linux

Original link: http://blog.sina.com.cn/s/blog_97688f8e0102uwtz.html

 

1. View the current file system

[root@VM_28_226_centos ~]# df

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/vda1              8254240   1099340   6735608  15% /

There is only one /dev/vda1 hanging under the root, that is, the system software is installed here

 

2. Check the current hard disk status

[root@VM_28_226_centos ~]# fdisk -l

Disk /dev/vda: 8589 MB, 8589901824 bytes

255 heads, 63 sectors/track, 1044 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: 0xcd6e8236

 

   Device Boot      Start         End      Blocks   Id  System

/dev/vda1   *           1        1044     8385898+  83  Linux

 

Disk /dev/vdb: 268.4 GB, 268435456000 bytes

16 heads, 63 sectors/track, 520126 cylinders

Units = cylinders of 1008 * 512 = 516096 bytes

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

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

Disk identifier: 0x00000000

 

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

 

Disk /dev/vdc: 2147 MB, 2147483648 bytes

16 heads, 63 sectors/track, 4161 cylinders

Units = cylinders of 1008 * 512 = 516096 bytes

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

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

Disk identifier: 0x00000000

 

Disk /dev/vdc doesn't contain a valid partition table
. See a disk, /dev/vdb, 270G. Format it now.

 

3. Formatting

[root@VM_28_226_centos ~]# mkfs.ext4 /dev/vdb

mke2fs 1.41.12 (17-May-2010)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

16384000 inodes, 65536000 blocks

3276800 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=4294967296

2000 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, 2654208, 

        4096000, 7962624, 11239424, 20480000, 23887872

 

Writing inode tables: done                            

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done

 

This filesystem will be automatically checked every 25 mounts or

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

-t 是指分区类型 这里用ext4

 

4、把磁盘挂载到/data

mount /dev/vdb /data

[root@VM_28_226_centos ~]# df

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/vda1              8254240   1099384   6735564  15% /

/dev/vdb             258030980    191708 244732072   1% /data

 

 

5、设置开机自动挂载(修改配置文件)
vim /etc/fstab
添加一条
/dev/vdb  /data  ext4  defaults 1 2

 

 

6、重新load挂载,挂载自动生效

mount -a

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326705266&siteId=291194637