先简略记载步骤:
  • 用fdisk –l命令查看
  • fdisk /dev/xvdb #进行磁盘分区;
  • command(M for help):n#新建分区
  • p#主分区
  • 1#/dev/xvdb1
  • 1#开始硬盘柱面
  • 1000#结束硬盘柱面
  • command(M for help):w#保存退出
  • mkfs.ext4 -E lazy_itable_init=1 /dev/xvb1 #将 xvdb1 分区格式化为 ext4 文件系统;
  • mkdir /data #创建目录;
  • echo "/dev/xvdb1 /data ext4 defaults,noatime,nodiratime 0 0 " >> /etc/fstab #修改系统配置文件;
  • mount -a #挂载磁盘 ;
  • ------------------------------------------------------ 第一次挂载新硬盘分区,虽然错了可以重来,但还是非常谨慎。查了资料,记录: df -h #查看硬盘分区空间的使用情况。 分区时的命令:
  • Command (m for help):   
  • 这里按m获得帮助   
  • a   toggle a bootable flag   将分区设置为启动区   
  • b   edit bsd disklabel    编辑bsd的disklabel   
  • c   toggle the dos compatibility flag  设置该分区为dos分区   
  • d   delete a partition 删除分区   
  • l   list known partition types  列出已知的分区类型   
  • m   print this menu  打印帮助列表   
  • n   add a new partition 创建新分区   
  • o   create a new empty DOS partition table   
  • p   print the partition table查看分区信息   
  • q   quit without saving changes 退出不保存   
  • s   create a new empty 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)  
  • /etc/fstab 文件的配置内容很多 ,在百度文库找到资料下载。搜索了个别参数的意义:(摘) 在 Linux 下面挂载文件系统的时候,加上 noatime 参数能大幅提高文件系统性能。不知道这个结论来自哪里,其实不需要像设置 noatime 那样设置 nodiratime,最可靠的资料应该是源代码,VPSee 查了一下源代码,发现在内核源代码 linux-2.6.33/fs/inode.c 文件里有一个 touch_atime 函数,可以看出如果 inode 的标记位是 NOATIME 的话就直接返回了,根本就走不到 NODIRATIME 那里去,所以只设置 noatime 就可以了,不必再设置 nodiratime. void touch_atime(struct vfsmount *mnt, struct dentry *dentry) 1405{ 1406        struct inode *inode = dentry->d_inode; 1407        struct timespec now; 1408 1409        if (inode->i_flags & S_NOATIME) 1410                return; 1411        if (IS_NOATIME(inode)) 1412                return; 1413        if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode)) 1414                return; 1415 1416        if (mnt->mnt_flags & MNT_NOATIME) 1417                return; 1418        if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode)) 1419                return; ... 1435}

    上一篇:
    下一篇:

    相关文章:

    Categories: 博客记录

    0 Responses so far.

    Leave a Reply