zoukankan      html  css  js  c++  java
  • 创建一个 20G 的分区,并格式化为 ext4 文件系统

     创建一个 20G 的分区,并格式化为 ext4 文件系统,并完成如下要求:

    (1)block 大小为 2048,预留空间 20%,卷标为 MYDATA

    #fdisk /dev/sdb -->n -->p -->1 -->1 -->+20G -->w
    #mkfs.ext4 -b 2048 -m 20 -L MYDATA  /dev/sdb1
    

    2挂载至/mydata 目录,要求挂载时禁止程序自动运行,且不更新文件的访问时间戳。

    #mkdir /mydata 
    #mount  -o  noexec,nodiratime -t ext4 -L MYDATA  /mydata 
    #mount |grep sdb1  --> /dev/sdb1 on /mydata type ext4 (rw,noexec,nodiratime)
    

    (3)可开机自动挂载。

    #vim /etc/fstab
    #在最后一行添加:/dev/sdb1               /mydata                 ext4    defaults,rw,noexec,nodiratime  0 0
     按照格式:要挂载的设备或伪文件系统         挂载点               文件系统类型  挂载选项 转储频率 自检次序 

    附操作步骤:

    [root@localhost ~]# fdisk /dev/sdb
    Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
    Building a new DOS disklabel with disk identifier 0xa4c9dc26.
    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 strongly recommended to
             switch off the mode (command 'c') and change display units to
             sectors (command 'u').
    
    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4): 1
    First cylinder (1-5221, default 1): 1
    Last cylinder, +cylinders or +size{K,M,G} (1-5221, default 5221): +20G
    
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    Syncing disks.
    
    [root@localhost ~]# mkfs.ext4 -b 2048 -m 20 -L MYDATA  /dev/sdb1
    mke2fs 1.41.12 (17-May-2010)
    Filesystem label=MYDATA
    OS type: Linux
    Block size=2048 (log=1)
    Fragment size=2048 (log=1)
    Stride=0 blocks, Stripe width=0 blocks
    1312768 inodes, 10490428 blocks
    2098085 blocks (20.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=548405248
    641 block groups
    16384 blocks per group, 16384 fragments per group
    2048 inodes per group
    Superblock backups stored on blocks: 
    	16384, 49152, 81920, 114688, 147456, 409600, 442368, 802816, 1327104, 
    	2048000, 3981312, 5619712, 10240000
    
    Writing inode tables: done                            
    Creating journal (32768 blocks): done
    Writing superblocks and filesystem accounting information: done
    
    This filesystem will be automatically checked every 39 mounts or
    180 days, whichever comes first.  Use tune2fs -c or -i to override.
    
    
    [root@localhost ~]# mkdir /mydata
    [root@localhost ~]# mount -o  noexec,nodiratime -t ext4 -L MYDATA  /mydata
    [root@localhost ~]# mount |grep sdb1
    /dev/sdb1 on /mydata type ext4 (rw,noexec,nodiratime)
  • 相关阅读:
    SQL Server IF Exists 判断数据库对象是否存在的用法
    C# RDLC报表不出现预览窗体直接输出到打印机
    C# 未安装Office环境下使用NPOI导出Excel文件
    C# 键盘中的按键对应KeyValue
    微信小程序下可以使用的MD5以及AES加密(通用)
    SQL Server 根据树状结构表生成以/号分割的路由字符串
    C# Winform下一个热插拔的MIS/MRP/ERP框架16(窗体基类场景2)
    WEB H5 JS QRCode二维码快速自动生成
    C# Winform 小技巧(Datagridview某一列按状态显示不同图片)
    获取请求地址的IP地址
  • 原文地址:https://www.cnblogs.com/caoshousong/p/10682145.html
Copyright © 2011-2022 走看看