码迷,mamicode.com
首页 > 系统相关 > 详细

Linux运维笔记-云服务器数据盘挂载

时间:2017-03-01 14:02:57      阅读:279      评论:0      收藏:0      [点我收藏+]

标签:tar   ack   its   his   over   defaults   decide   display   contain   

1.查看要挂载的空间

 1 [root@iZuf6610s5jsqm9fr53nslZ ~]# fdisk -l
 2 
 3 Disk /dev/vda: 42.9 GB, 42949672960 bytes
 4 255 heads, 63 sectors/track, 5221 cylinders
 5 Units = cylinders of 16065 * 512 = 8225280 bytes
 6 Sector size (logical/physical): 512 bytes / 512 bytes
 7 I/O size (minimum/optimal): 512 bytes / 512 bytes
 8 Disk identifier: 0x00053156
 9 
10    Device Boot      Start         End      Blocks   Id  System
11 /dev/vda1   *           1        5222    41942016   83  Linux
12 
13 Disk /dev/vdb: 107.4 GB, 107374182400 bytes
14 16 heads, 63 sectors/track, 208050 cylinders
15 Units = cylinders of 1008 * 512 = 516096 bytes
16 Sector size (logical/physical): 512 bytes / 512 bytes
17 I/O size (minimum/optimal): 512 bytes / 512 bytes
18 Disk identifier: 0x00000000

 

2.添加分区

 1 [root@iZuf6610s5jsqm9fr53nslZ ~]# fdisk /dev/vdb 
 2 Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
 3 Building a new DOS disklabel with disk identifier 0x65cce73f.
 4 Changes will remain in memory only, until you decide to write them.
 5 After that, of course, the previous content wont be recoverable.
 6 
 7 Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
 8 
 9 WARNING: DOS-compatible mode is deprecated. Its strongly recommended to
10          switch off the mode (command c) and change display units to
11          sectors (command u).
12 
13 Command (m for help): n
14 Command action
15    e   extended
16    p   primary partition (1-4)
17 1
18 Invalid partition number for type `119 Command action
20    e   extended
21    p   primary partition (1-4)
22 p
23 Partition number (1-4): 1
24 First cylinder (1-208050, default 1): 
25 Using default value 1
26 Last cylinder, +cylinders or +size{K,M,G} (1-208050, default 208050): 
27 Using default value 208050
28 
29 Command (m for help): wq
30 The partition table has been altered!
31 
32 Calling ioctl() to re-read partition table.
33 Syncing disks.

fdisk 对应分区 相继输入 n, p, 1,  wq

3.查看当前分区情况

 1 [root@iZuf6610s5jsqm9fr53nslZ ~]# fdisk -l
 2 
 3 Disk /dev/vda: 42.9 GB, 42949672960 bytes
 4 255 heads, 63 sectors/track, 5221 cylinders
 5 Units = cylinders of 16065 * 512 = 8225280 bytes
 6 Sector size (logical/physical): 512 bytes / 512 bytes
 7 I/O size (minimum/optimal): 512 bytes / 512 bytes
 8 Disk identifier: 0x00053156
 9 
10    Device Boot      Start         End      Blocks   Id  System
11 /dev/vda1   *           1        5222    41942016   83  Linux
12 
13 Disk /dev/vdb: 107.4 GB, 107374182400 bytes
14 16 heads, 63 sectors/track, 208050 cylinders
15 Units = cylinders of 1008 * 512 = 516096 bytes
16 Sector size (logical/physical): 512 bytes / 512 bytes
17 I/O size (minimum/optimal): 512 bytes / 512 bytes
18 Disk identifier: 0x65cce73f
19 
20    Device Boot      Start         End      Blocks   Id  System
21 /dev/vdb1               1      208050   104857168+  83  Linux

 

4.格式化分区

 1 [root@iZuf6610s5jsqm9fr53nslZ ~]# mkfs.ext3 /dev/vdb1 
 2 mke2fs 1.41.12 (17-May-2010)
 3 Filesystem label=
 4 OS type: Linux
 5 Block size=4096 (log=2)
 6 Fragment size=4096 (log=2)
 7 Stride=0 blocks, Stripe width=0 blocks
 8 6553600 inodes, 26214292 blocks
 9 1310714 blocks (5.00%) reserved for the super user
10 First data block=0
11 Maximum filesystem blocks=4294967296
12 800 block groups
13 32768 blocks per group, 32768 fragments per group
14 8192 inodes per group
15 Superblock backups stored on blocks: 
16     32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
17     4096000, 7962624, 11239424, 20480000, 23887872
18 
19 Writing inode tables: done                            
20 Creating journal (32768 blocks): done
21 Writing superblocks and filesystem accounting information: done
22 
23 This filesystem will be automatically checked every 31 mounts or
24 180 days, whichever comes first.  Use tune2fs -c or -i to override.

 

5.挂载硬盘

 1 #创建要挂载的目录
 2 mkdir /data
 3 
 4 #挂载分区
 5 mount /dev/vdb1 /data/
 6 
 7 #写入分区信息
 8 echo "/dev/vdb1  /data ext3    defaults    0  0" >> /etc/fstab
 9 
10 #查看分许信息
11 cat /etc/fstab

 

Linux运维笔记-云服务器数据盘挂载

标签:tar   ack   its   his   over   defaults   decide   display   contain   

原文地址:http://www.cnblogs.com/coder-ct/p/6483622.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!