管理磁盘

[root@oratest ~]# fdisk -l

查看分区表

 

Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk label type: dos

Disk identifier: 0x0448641b

 

  • fdisk磁盘分区
    • -b 指定 分区大小
    • -l 列出指定的外围设备的分区表状况
    • -s <分区编号>
    • 1-4   扩展分区
    • 5-   逻辑分区

  • Sda 第一块

  • Sdb 第二块
  • 添加硬盘
    • 磁盘类型ISCSI需要重启(reboot)
    • SATA不需要重启
    • Linux的设备通过文件管理

IDE设备

/dev/hd[a-d]

Scsi/SATA/U盘

/dev/sd[a-p]

软驱

/dev/fd[0-1]

打印机

/dev/lp[0-15]

光驱

/dev/cdrom

鼠标

/dev/house

磁带机

/dev/st0或/ht0

 

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048     1640447      819200   83  Linux

 

Disk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk label type: dos

Disk identifier: 0x000622c6

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     1026047      512000   83  Linux

/dev/sda2         1026048    83886079    41430016   8e  Linux LVM

 

Disk /dev/mapper/rhel-root: 40.2 GB, 40227569664 bytes, 78569472 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

 

 

Disk /dev/mapper/rhel-swap: 2147 MB, 2147483648 bytes, 4194304 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

 

[root@oratest ~]# fdisk /dev/sdb

分区

Welcome to fdisk (util-linux 2.23.2).

 

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

 

 

  • Command(m for help): m      ---输出帮助信息

Commandaction

   a  toggle a bootable flag  ---设置启动分区

   b  edit bsd disklabel      ---编辑分区标签

   c  toggle the dos compatibility flag

   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  --创建一个新的空白DOS分区表

   p  print the partition table               ---打印分区表

   q  quit without saving changes           ---退出不保存

   s   createa new empty Sun disklabel        ---创建一个有新标签的磁盘

   t   changea partition's system id          ---改变分区的ID

   u   changedisplay/entry units            ---改变显示的单位

   v   verifythe partition table              ---检查验证分区表

   w  write table to disk and exit            ---保存分区表

   x  extra functionality (experts only)

 

 

 

Command (m for help): m

显示命令行

Command action

   a   toggle a bootable flag

   b   edit bsd disklabel

   c   toggle the dos compatibility flag

   d   delete a partition

删除硬盘分割情形

   g   create a new empty GPT partition table

   G   create an IRIX (SGI) partition table

   l   list known partition types

   m   print this menu

显示命令列式

   n   add a new partition

设定新硬盘分割区

 

E   延伸分割区

 

P   主要分割区

   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)

 

Command (m for help): l

查看分区类型(t改变)

 

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris       

 1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-

 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-

 3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden C:  c6  DRDOS/sec (FAT-

 4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx        

 5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data   

 6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .

 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility  

 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt        

 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access    

 a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O       

 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor     

 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi eb  BeOS fs       

 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT           

 f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12/16/

10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux/PA-RISC b

11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor     

12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f4  SpeedStor     

14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f2  DOS secondary 

16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      fb  VMware VMFS   

17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE

18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fd  Linux raid auto

1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep       

1c  Hidden W95 FAT3 75  PC/IX           be  Solaris boot    ff  BBT           

1e  Hidden W95 FAT1 80  Old Minix     

 

Command (m for help): n

新建分区

Partition type:

   p   primary (1 primary, 0 extended, 3 free)

   e   extended

Select (default p):

Using default response p

Partition number (2-4, default 2):

First sector (1640448-41943039, default 1640448):

Using default value 1640448

Last sector, +sectors or +size{K,M,G} (1640448-41943039, default 41943039):

Using default value 41943039

Partition 2 of type Linux and of size 19.2 GiB is set

 

Command (m for help): p

输出分区表

 

Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk label type: dos

Disk identifier: 0x0448641b

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048     1640447      819200   83  Linux

/dev/sdb2         1640448    41943039    20151296   83  Linux

 

Command (m for help): w

保存退出

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

 

[root@oratest ~]# fdisk -l

查看分区表

 

Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk label type: dos

Disk identifier: 0x0448641b

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048     1640447      819200   83  Linux

/dev/sdb2         1640448    41943039    20151296   83  Linux

 

Disk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk label type: dos

Disk identifier: 0x000622c6

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     1026047      512000   83  Linux

/dev/sda2         1026048    83886079    41430016   8e  Linux LVM

 

Disk /dev/mapper/rhel-root: 40.2 GB, 40227569664 bytes, 78569472 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

 

 

Disk /dev/mapper/rhel-swap: 2147 MB, 2147483648 bytes, 4194304 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

 

 

root@oratest ~]# mkfs -t ext4 /dev/sdb1

建立ext4的文件系统

mke2fs 1.42.9 (28-Dec-2013)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

51296 inodes, 204800 blocks

10240 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=209715200

7 block groups

32768 blocks per group, 32768 fragments per group

7328 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840

 

Allocating group tables: done                           

Writing inode tables: done                           

Creating journal (4096 blocks): done

Writing superblocks and filesystem accounting information: done

 

 

  • mkfs 建立文件系统
    • -t  文件系统类型
      • Mkfs
      • Mkfs.xfs
  • # m for help
    • D  delete 删除硬盘分区
    • M 显示所有命令行
    • P 显示硬盘分割情形
    • N 设定新的硬盘属性
      • E  延伸分割区
      • P  主要分区
    • Q 结束不保存
    • W 结束保存

 

[root@oratest ~]# mkfs.xfs /dev/sdb2

建立xfs的文件系统

meta-data=/dev/sdb2              isize=256    agcount=4, agsize=1259456 blks

         =                       sectsz=512   attr=2, projid32bit=1

         =                       crc=0        finobt=0

data     =                       bsize=4096   blocks=5037824, imaxpct=25

         =                       sunit=0      swidth=0 blks

naming   =version 2              bsize=4096   ascii-ci=0 ftype=0

log      =internal log           bsize=4096   blocks=2560, version=2

         =                       sectsz=512   sunit=0 blks, lazy-count=1

realtime =none                   extsz=4096   blocks=0, rtextents=0

 

[root@oratest ~]# mount /dev/sdb1 /mnt/disk1

 

[root@oratest ~]# mount -o ro /dev/sdb1 /mnt/disk2

用只读模式

mount: /dev/sdb1 is already mounted or /mnt/disk2 busy

       /dev/sdb1 is already mounted on /mnt/disk1

[root@oratest ~]# umount /dev/cdrom

卸载文件系统

  • Umount 卸载文件系统

 

 

[root@oratest ~]# mount

查看系统当前的挂载信息

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)

proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)

devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=918808k,nr_inodes=229702,mode=755)

securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)

tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)

devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)

tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)

tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755)

cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)

pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)

cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)

cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)

cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)

cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)

cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)

cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)

cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)

cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)

cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)

configfs on /sys/kernel/config type configfs (rw,relatime)

/dev/mapper/rhel-root on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)

selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)

systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=28,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)

mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)

debugfs on /sys/kernel/debug type debugfs (rw,relatime)

hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)

nfsd on /proc/fs/nfsd type nfsd (rw,relatime)

/dev/sda1 on /boot type xfs (rw,relatime,seclabel,attr2,inode64,noquota)

tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=186872k,mode=700,uid=1000,gid=1000)

fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)

gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

/dev/sdb1 on /mnt/disk1 type ext4 (rw,relatime,seclabel,data=ordered)

/dev/sr0 on /run/media/stu06/RHEL-7.2 Server.x86_64 type iso9660 (ro,nosuid,nodev,relatime,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks2)

 

 

[root@oratest ~]# du -h

 

4.0K        ./.cache/dconf

4.0K        ./.cache/abrt

8.0K        ./.cache

4.0K        ./.dbus/session-bus

4.0K        ./.dbus

0        ./.config/ibus/bus

0        ./.config/ibus

0        ./.config/abrt

0        ./.config

0        ./iso

88K        .

  • du查看目录和文件使用的空间

 

 

[root@oratest ~]# df -h

 

Filesystem             Size  Used Avail Use% Mounted on

/dev/mapper/rhel-root   38G  4.2G   34G  11% /

devtmpfs               898M     0  898M   0% /dev

tmpfs                  913M  192K  913M   1% /dev/shm

tmpfs                  913M   21M  893M   3% /run

tmpfs                  913M     0  913M   0% /sys/fs/cgroup

/dev/sda1              497M  158M  340M  32% /boot

tmpfs                  183M   12K  183M   1% /run/user/1000

/dev/sdb1              772M  1.6M  714M   1% /mnt/disk1

/dev/sr0               3.8G  3.8G     0 100% /run/media/stu06/RHEL-7.2 Server.x86_64

  • df显示磁盘分区上可使用的磁盘空间

-a 全部

 

[root@oratest ~]# fdisk -l

查看磁盘空间使用情况

 

Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk label type: dos

Disk identifier: 0x0448641b

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048     1640447      819200   83  Linux

/dev/sdb2         1640448    41943039    20151296   83  Linux

 

Disk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk label type: dos

Disk identifier: 0x000622c6

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     1026047      512000   83  Linux

/dev/sda2         1026048    83886079    41430016   8e  Linux LVM

  • sda2采用LVM 管理

 

Disk /dev/mapper/rhel-root: 40.2 GB, 40227569664 bytes, 78569472 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

 

 

Disk /dev/mapper/rhel-swap: 2147 MB, 2147483648 bytes, 4194304 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

 

 

  • 建立一个800M的逻辑分区

[root@oratest ~]# fdisk /dev/sdb

 

Welcome to fdisk (util-linux 2.23.2).

 

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

 

 

Command (m for help): n

 

Partition type:

   p   primary (2 primary, 0 extended, 2 free)

   e   extended

Select (default p): e

Partition number (3,4, default 3):

No free sectors available

 

Command (m for help):

Command (m for help): e

 

e: unknown command

Command action

   a   toggle a bootable flag

   b   edit bsd disklabel

   c   toggle the dos compatibility flag

   d   delete a partition

   g   create a new empty GPT partition table

   G   create an IRIX (SGI) partition table

   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)

 

Command (m for help): n

 

Partition type:

   p   primary (2 primary, 0 extended, 2 free)

   e   extended

Select (default p): e

Partition number (3,4, default 3): 3

No free sectors available

 

Command (m for help): 3

3: unknown command

Command action

   a   toggle a bootable flag

   b   edit bsd disklabel

   c   toggle the dos compatibility flag

   d   delete a partition

   g   create a new empty GPT partition table

   G   create an IRIX (SGI) partition table

   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)

 

Command (m for help): e

 

e: unknown command

Command action

   a   toggle a bootable flag

   b   edit bsd disklabel

   c   toggle the dos compatibility flag

   d   delete a partition

   g   create a new empty GPT partition table

   G   create an IRIX (SGI) partition table

   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)

 

Command (m for help): nn

Partition type:

   p   primary (2 primary, 0 extended, 2 free)

   e   extended

Select (default p): e

Partition number (3,4, default 3):

No free sectors available

 

Command (m for help): q

 

[root@oratest ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

 

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

 

 

Command (m for help): n

 

Partition type:

   p   primary (2 primary, 0 extended, 2 free)

   e   extended

Select (default p): e

Partition number (3,4, default 3):

No free sectors available

 

Command (m for help): d

Partition number (1,2, default 2): 1

Partition 1 is deleted

 

Command (m for help): d

Selected partition 2

Partition 2 is deleted

 

Command (m for help): n

Partition type:

   p   primary (0 primary, 0 extended, 4 free)

   e   extended

Select (default p): e

Partition number (1-4, default 1):

First sector (2048-41943039, default 2048):

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):

Using default value 41943039

Partition 1 of type Extended and of size 20 GiB is set

 

Command (m for help): p

 

Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk label type: dos

Disk identifier: 0x0448641b

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048    41943039    20970496    5  Extended

 

  • 使用扩展分区就要建立逻辑分区

 

Command (m for help): n

 

Partition type:

   p   primary (0 primary, 1 extended, 3 free)

   l   logical (numbered from 5)

Select (default p): l

Adding logical partition 5

First sector (4096-41943039, default 4096):

Using default value 4096

Last sector, +sectors or +size{K,M,G} (4096-41943039, default 41943039): +800M

Partition 5 of type Linux and of size 800 MiB is set

 

Command (m for help): p

 

Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors

Units = sectors of 1 * 512 = 512 bytes

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

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

Disk label type: dos

Disk identifier: 0x0448641b

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048    41943039    20970496    5  Extended

/dev/sdb5            4096     1642495      819200   83  Linux

 

Command (m for help): w

存盘退出

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

 

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

Syncing disks.

 

 

  • 建立文件系统

[root@oratest ~]# mkfs.xfs /dev/sdb5

 

/dev/sdb5: No such file or directory

系统未找到,需重启

Usage: mkfs.xfs

/* blocksize */                [-b log=n|size=num]

/* metadata */                [-m crc=0|1,finobt=0|1]

/* data subvol */        [-d agcount=n,agsize=n,file,name=xxx,size=num,

    (sunit=value,swidth=value|su=num,sw=num|noalign),

    sectlog=n|sectsize=num

/* force overwrite */        [-f]

/* inode size */        [-i log=n|perblock=n|size=num,maxpct=n,attr=0|1|2,

    projid32bit=0|1]

/* no discard */        [-K]

/* log subvol */        [-l agnum=n,internal,size=num,logdev=xxx,version=n

    sunit=value|su=num,sectlog=n|sectsize=num,

    lazy-count=0|1]

/* label */                [-L label (maximum 12 characters)]

/* naming */                [-n log=n|size=num,version=2|ci,ftype=0|1]

/* no-op info only */        [-N]

/* prototype file */        [-p fname]

/* quiet */                [-q]

/* realtime subvol */        [-r extsize=num,size=num,rtdev=xxx]

/* sectorsize */        [-s log=n|size=num]

/* version */                [-V]

devicename

<devicename> is required unless -d name=xxx is given.

<num> is xxx (bytes), xxxs (sectors), xxxb (fs blocks), xxxk (xxx KiB),

      xxxm (xxx MiB), xxxg (xxx GiB), xxxt (xxx TiB) or xxxp (xxx PiB).

<value> is xxx (512 byte blocks).

root@oratest ~]# reboot

重启

  • 进入字符界面,输入账号密码,init 5 回到图形界面

[root@localhost ~]# mkfs.xfs /dev/sdb5

 

meta-data=/dev/sdb5              isize=256    agcount=4, agsize=51200 blks

         =                       sectsz=512   attr=2, projid32bit=1

         =                       crc=0        finobt=0

data     =                       bsize=4096   blocks=204800, imaxpct=25

         =                       sunit=0      swidth=0 blks

naming   =version 2              bsize=4096   ascii-ci=0 ftype=0

log      =internal log           bsize=4096   blocks=853, version=2

         =                       sectsz=512   sunit=0 blks, lazy-count=1

realtime =none                   extsz=4096   blocks=0, rtextents=0

[root@localhost ~]# mkdir /newdate

建立目录

[root@localhost ~]# mount /dev/sdb5 /newdate/

挂载分区

[root@localhost ~]# mount

 

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)

proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)

devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=918808k,nr_inodes=229702,mode=755)

securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)

tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)

devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)

tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)

tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755)

cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)

pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)

cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)

cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)

cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)

cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)

cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)

cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)

cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)

cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)

cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)

configfs on /sys/kernel/config type configfs (rw,relatime)

/dev/mapper/rhel-root on / type xfs (rw,relatime,seclabel,attr2,inode64,noquota)

selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)

systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=34,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)

debugfs on /sys/kernel/debug type debugfs (rw,relatime)

mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)

hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)

nfsd on /proc/fs/nfsd type nfsd (rw,relatime)

/dev/sda1 on /boot type xfs (rw,relatime,seclabel,attr2,inode64,noquota)

tmpfs on /run/user/42 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=186872k,mode=700,uid=42,gid=42)

tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=186872k,mode=700,uid=1000,gid=1000)

fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)

gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

/dev/sr0 on /run/media/stu06/RHEL-7.2 Server.x86_64 type iso9660 (ro,nosuid,nodev,relatime,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks2)

/dev/sdb5 on /newdate type xfs (rw,relatime,seclabel,attr2,inode64,noquota)



  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值