网络

教育改变生活

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1605|回复: 0
打印 上一主题 下一主题

[其他] 磁盘和文件系统管理1

[复制链接]

535

主题

562

帖子

4万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
41581

最佳新人活跃会员热心会员推广达人宣传达人灌水之王突出贡献优秀版主荣誉管理论坛元老

跳转到指定楼层
楼主
发表于 2020-3-30 15:57:08 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
[root@localhost /]# fdisk -l
Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009f2bd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64       26109   209202176   8e  Linux LVM

Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_swap: 4194 MB, 4194304000 bytes
255 heads, 63 sectors/track, 509 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_home: 156.3 GB, 156338487296 bytes
255 heads, 63 sectors/track, 19007 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
[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 0x3398addd.
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): m
Command action
   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
   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
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-10443, default 1):此处直接回车
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-10443, default 10443): +20G

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (2613-10443, default 2613):此处直接回车
Using default value 2613
Last cylinder, +cylinders or +size{K,M,G} (2613-10443, default 10443): +20G

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Partition number (1-4): 4
First cylinder (5225-10443, default 5225):此处直接回车
Using default value 5225
Last cylinder, +cylinders or +size{K,M,G} (5225-10443, default 10443):此处直接回车
Using default value 10443

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (5225-10443, default 5225):此处直接回车
Using default value 5225
Last cylinder, +cylinders or +size{K,M,G} (5225-10443, default 10443): +2G

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (5487-10443, default 5487):此处直接回车
Using default value 5487
Last cylinder, +cylinders or +size{K,M,G} (5487-10443, default 10443): +10G

Command (m for help): P

Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xcd20ee87

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2612    20980858+  83  Linux
/dev/sdb2            2613        5224    20980890   83  Linux
/dev/sdb4            5225       10443    41921617+   5  Extended
/dev/sdb5            5225        5486     2104483+  83  Linux
/dev/sdb6            5487        6792    10490413+  83  Linux

Command (m for help): t
Partition number (1-6): 5
Hex code (type L to list codes): 82
Changed system type of partition 5 to 82 (Linux swap / Solaris)

Command (m for help): p

Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xcd20ee87

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2612    20980858+  83  Linux
/dev/sdb2            2613        5224    20980890   83  Linux
/dev/sdb4            5225       10443    41921617+   5  Extended
/dev/sdb5            5225        5486     2104483+  82  Linux swap / Solaris
/dev/sdb6            5487        6792    10490413+  83  Linux

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: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009f2bd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64       26109   209202176   8e  Linux LVM

Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xcd20ee87

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2612    20980858+  83  Linux
/dev/sdb2            2613        5224    20980890   83  Linux
/dev/sdb4            5225       10443    41921617+   5  Extended
/dev/sdb5            5225        5486     2104483+  82  Linux swap / Solaris
/dev/sdb6            5487        6792    10490413+  83  Linux

Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_swap: 4194 MB, 4194304000 bytes
255 heads, 63 sectors/track, 509 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_home: 156.3 GB, 156338487296 bytes
255 heads, 63 sectors/track, 19007 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

[root@localhost /]#
[root@rhel /]# partprobe /dev/sdb
[root@rhel /]# ls /sbin/mkfs*
/sbin/mkfs         /sbin/mkfs.ext2  /sbin/mkfs.ext4     /sbin/mkfs.msdos
/sbin/mkfs.cramfs  /sbin/mkfs.ext3  /sbin/mkfs.ext4dev  /sbin/mkfs.vfat
[root@rhel /]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0001a205

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      102400   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              13         274     2097152   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3             274        2611    18770944   83  Linux

Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xec3d3bc9

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2551    20490876   83  Linux
/dev/sdb2            2552        5102    20490907+  83  Linux
/dev/sdb4            5103       10443    42901582+   5  Extended
/dev/sdb5            5103        5358     2056288+  82  Linux swap / Solaris
/dev/sdb6            5359        6634    10249438+  83  Linux

Disk /dev/sdc: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

[root@rhel /]# partprobe /dev/sdb
[root@rhel /]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0001a205

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      102400   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              13         274     2097152   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3             274        2611    18770944   83  Linux

Disk /dev/sdb: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xec3d3bc9

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2551    20490876   83  Linux
/dev/sdb2            2552        5102    20490907+  83  Linux
/dev/sdb4            5103       10443    42901582+   5  Extended
/dev/sdb5            5103        5358     2056288+  82  Linux swap / Solaris
/dev/sdb6            5359        6634    10249438+  83  Linux
/dev/sdb7            6635        7910    10249438+  83  Linux

Disk /dev/sdc: 85.9 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

[root@rhel /]# mkfs -t ext3 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
\u6587\u4ef6\u7cfb\u7edf\u6807\u7b7e=
\u64cd\u4f5c\u7cfb\u7edfinux
\u5757\u5927\u5c0f=4096 (log=2)
\u5206\u5757\u5927\u5c0f=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1281120 inodes, 5122719 blocks
256135 blocks (5.00%) reserved for the super user
\u7b2c\u4e00\u4e2a\u6570\u636e\u5757=0
Maximum filesystem blocks=0
157 block groups
32768 blocks per group, 32768 fragments per group
8160 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000

\u6b63\u5728\u5199\u5165inode\u8868: \u5b8c\u6210                           
Creating journal (32768 blocks): \u5b8c\u6210
Writing superblocks and filesystem accounting information: \u5b8c\u6210

This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@rhel /]# mkfs -t vfat -F 32 /dev/sdb6   如果我们要挂载的是U盘。
mkfs.vfat 3.0.9 (31 Jan 2010)
[root@rhel /]# mkswap /dev/sdb5
Setting up swapspace version 1, size = 2056284 KiB
no label, UUID=aca7e52d-acd7-4e2d-adf7-d0828668127b
[root@rhel /]# cat /proc/meminfo | grep "SwapTotal:"
SwapTotal:       2097144 kB
[root@rhel /]# swapon /dev/sdb5
[root@rhel /]# cat /proc/meminfo | grep "SwapTotal:"
SwapTotal:       4153424 kB
[root@rhel /]# swapoff /dev/sdb5
[root@rhel /]# cat /proc/meminfo | grep "SwapTotal:"
SwapTotal:       2097144 kB
[root@rhel /]# mkdir /mailbox
[root@rhel /]# mount /dev/sdb1 /mailbox/
[root@rhel /]# vi /etc/fstab
[root@rhel /]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Fri Jun  7 00:57:58 2013
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=3eb0c7ea-31b0-460f-961a-414739c61207 /                       ext4    defaults        1 1
UUID=d6cdff6e-b69d-45f0-82a6-6d2062007bb1 /boot                   ext4    defaults        1 2
UUID=bf3e0ead-dd2f-4ecd-875d-c22270fe60b0 swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/sdb1              /mailbox                ext3    defaults        0 0
[root@rhel /]# df -hT
\u6587\u4ef6\u7cfb\u7edf    \u7c7b\u578b      \u5bb9\u91cf  \u5df2\u7528  \u53ef\u7528 \u5df2\u7528%% \u6302\u8f7d\u70b9
/dev/sda3     ext4     18G  3.7G   14G  22% /
tmpfs        tmpfs    740M  448K  739M   1% /dev/shm
/dev/sda1     ext4     97M   27M   66M  29% /boot
/dev/sr0   iso9660    3.0G  3.0G     0 100% /media/RHEL_6.4 i386 Disc 1
/dev/sdb1     ext3     20G  173M   19G   1% /mailbox
[root@rhel /]#



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

WEB前端

QQ|手机版|小黑屋|金桨网|助学堂  咨询请联系站长。

GMT+8, 2024-12-22 15:10 , Processed in 0.035723 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表