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

1.查看要挂载的空间

 1 [[email protected] ~]# 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 [[email protected] ~]# 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 won‘t 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. It‘s 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 `1‘
19 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 [[email protected] ~]# 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 [[email protected] ~]# 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
时间: 2024-07-30 13:51:55

Linux运维笔记-云服务器数据盘挂载的相关文章

Linux运维笔记20180001-文件与目录管理权限

这段时间想了很多,虽然准备考研,但最后的目的也是为了工作,所以每天都会抽出一个小时来巩固运维的小知识.我觉得老师对我讲的一句话是对的,聪明的人会把两件事情同时做好.我没有盲目自信,毕竟时间精力有限,每天固定三个知识点,我会坚持做好.我的笔记基本源于网络整理,作为一位大学生,我觉得版权的问题没有商量的余地,在借鉴别人的文章时,我会把人家的地址贴出,以此让更多的人看见,致敬鸟叔,向那些在路上的程序员致敬. 1.umask 文件默认权限(0022) (1)root用户:默认022 文件:  -rw-r

运维 阿里云服务器扩容

一 缘由 公司服务器磁盘满了,在扩容的过程中有很多坑,写出来. 扩容前的磁盘情况, /dev/xvdb1 文件系统已经 二 扩容过程 可参考 阿里云扩容官方文档 第1步:进入 ECS 控制台 第2步:选择 "全部磁盘" 页或者"本实例磁盘" 页 第3步:在每一个磁盘条目的最后选择"更多" 第4步:选择"磁盘扩容",即可进入磁盘扩容操作页 第5步:输入你希望扩容的目标大小 第6步:重启 成功开通后,您需要通过ECS控制台或ECS

Linux 运维笔记

#配置静态地址网卡DEVICE="eth0"BOOTPROTO=staticHWADDR="00:0C:29:DC:EA:F7"NM_CONTROLLED="yes"ONBOOT=yesIPADDR=192.168.227.140NETMASK=255.255.255.0GATEWAY=192.168.227.1TYPE=Ethernet #SHH登陆系统ssh [email protected] #查看网卡mac地址dmesg | grep &

Linux运维笔记--第二部

第2部-重要目录结构详解 1.回顾Linux目录结构知识 /dev/            设备目录 /etc/             系统配置及服务配置文件,启动命令的目录 /proc            显示内核及进程信息的虚拟文件系统 /tmp             临时文件目录,公共厕所,客厅 /home          普通用户家目录,大臣的家 /root             超级管理员的家目录,皇宫 /var               变化的目录,一般是日志文件,cac

Linux运维笔记--第三部

第三部 3. Linux系统文件重要知识初步讲解 # ls  -lhi   (i: inode,每个文件前的数字代表文件身份ID:h: human 人类可读) 显示:25091 -rw-r--r-- 1 root root 81 4月 15 00:33 oldboy.txt 第1列:inode=>index node  索引节点编号. 第2列:文件类型及权限(共10个字符,第一个字符为类型,后9个字符为文件权限). 第3列:硬链接个数( 详细参看ln命令的讲解).硬链接是文件的又一个入口. 第4

Linux运维笔记20180002-安全加固

关于"安全加固" 安全 是相对的. 加固 可能涉及系统内所有方面:(1)硬件.比如:Intel X86 硬件漏洞:(2)操作系统.从安装部署到安装后运行:(3)系统服务.服务本身安装配置.服务涉及的系统资源.外部对服务的访问(数据交流). 举例说明:RHEL的安装部署.系统配置.系统服务设置. 1.关于操作系统 尽可能,使用官方发布的系统: 尽可能选择当前"主流"的版本. 比如:RHEL 大的版本:6.X  6.8 7.X 7.2.7.5 1.1 关于操作系统的安装

Apache拂去其运维笔记(4)----服务器扩展部分

在Apache的默认配置文件夹中有一个 extra 目录,这个目录是用来存放 Apache 其他模块的配置文件的.这些文件是 Apache 针对常用的模块而设置并提供的,它们都是通过 Include 指令来加载的.如果需要使用则只需要在 httpd.conf 文件中相应的加载行前删除 "#" ,将其注释取消,使用这些文件可以很方便地进行有针对性的修改,而不用在httpd.conf 里查找半天.Apache 扩展配置文件如下所示: 文件名 用途 httpd-autoindex.conf

Linux运维笔记-后端运行脚本

1.当前终端后端运行 test.sh & 2.退出终端仍然后端运行 nohup test.sh &

linux运维笔记day6--基础命令

创建硬盘 cd /dev/ fdisk -l:查看磁盘分区的容量 fdisk -l /dev/sda/ :查看第一块scsi硬盘分区的容量 fdisk -l /dev/hdb/ :查看第二块IDE硬盘分区的的容量 man fdisk ll /proc/ :存放存储进程,硬盘信息 cat /proc/partition:查看硬盘分区 df :查看分区 df -Th :查看分区大小,以M/G为单位 du -sh *  :查看目录下所有文件的大小 新建硬盘 在VMware里: 硬件--硬盘--添加 f