rehl7 挂载分区实验

rehl7 挂载分区实验

[root@localhost ~]# fdisk -l //查看分区

Disk /dev/sda: 10.7 GB, 10737418240 bytes, 20971520 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: 0x00013f3e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    20970332    10484142+  83  Linux

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 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@localhost ~]# fdisk /dev/sdb //分区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.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x07931636.

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 //新建一个分区
   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 (0 primary, 0 extended, 4 free) //主分区 、默认
   e   extended //逻辑分区
Select (default p): p
Partition number (1-4, default 1): 1 //第一个主分区
First sector (2048-20971519, default 2048): //第一分区、默认2048
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): 10971519//分区大小
Partition 1 of type Linux and of size 5.2 GiB is set

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (2-4, default 2): 2
First sector (10971520-20971519, default 10973184): 
Using default value 10973184
Last sector, +sectors or +size{K,M,G} (10973184-20971519, default 20971519): 
Using default value 20971519
Partition 2 of type Linux and of size 4.8 GiB is set

Command (m for help): w //保存并退出
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# fdisk -l

Disk /dev/sda: 10.7 GB, 10737418240 bytes, 20971520 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: 0x00013f3e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    20970332    10484142+  83  Linux

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 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: 0x07931636

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    10971519     5484736   83  Linux
/dev/sdb2        10973184    20971519     4999168   83  Linux
          
[root@localhost ~]# mkfs -t ext4 /dev/sdb1 //制定类型 ext4  sdb1
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
343392 inodes, 1371184 blocks
68559 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1405091840
42 block groups
32768 blocks per group, 32768 fragments per group
8176 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 

[root@localhost ~]# mkfs -t ext4 /dev/sdb2
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
312624 inodes, 1249792 blocks
62489 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1281359872
39 block groups
32768 blocks per group, 32768 fragments per group
8016 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 

[root@localhost ~]# mkdir /home/newfile
[root@localhost ~]# mount
mount       mount.fuse  mount.nfs   mount.nfs4  mountpoint  mountstats  
[root@localhost ~]# mount /dev/sdb1 /home/newfile/
[root@localhost ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        10G  3.1G  7.0G  31% /
devtmpfs        475M     0  475M   0% /dev
tmpfs           490M   80K  490M   1% /dev/shm
tmpfs           490M   14M  477M   3% /run
tmpfs           490M     0  490M   0% /sys/fs/cgroup
/dev/sdb1       5.1G   21M  4.8G   1% /home/newfile

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值