RedHat Linux磁盘分区、格式化、挂载、卸载

[root@CORPSE2010/]# fdisk -l


Disk /dev/sda: 322.1 GB, 322122547200 bytes
255 heads, 63 sectors/track, 39162 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: 0x00097ff5


   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26       28072   225280000   83  Linux
/dev/sda3           28072       32152    32768000   82  Linux swap / Solaris
/dev/sda4           32152       39163    56318976    5  Extended
/dev/sda5           32152       33427    10240000   83  Linux
/dev/sda6           33427       34702    10240000   83  Linux
/dev/sda7           34702       35976    10240000   83  Linux
/dev/sda8           35977       39163    25594880   83  Linux


Disk /dev/sdb: 32.2 GB, 32212254720 bytes        ----------未挂载的
64 heads, 32 sectors/track, 30720 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000




[root@CORPSE2010:WEIHU]# 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 0x810d5e15.
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)
1
Invalid partition number for type `1'
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-30720, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-30720, default 30720): 
Using default value 30720


Command (m for help): p


Disk /dev/sdb: 32.2 GB, 32212254720 bytes
64 heads, 32 sectors/track, 30720 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x810d5e15


   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       30720    31457264   83  Linux             ---ext4分区,ID为83


Command (m for help): w
The partition table has been altered!


Calling ioctl() to re-read partition table.
Syncing disks.
[root@CORPSE2010:WEIHU]# partprobe /dev/sdb
[root@CORPSE2010:WEIHU]# mkfs -V -t ext4 -c /dev/sdb1
mkfs (util-linux-ng 2.17.2)
mkfs.ext4 -c /dev/sdb1 
mke2fs 1.41.12 (17-May-2010)
鏂囦欢绯荤粺鏍囩=
鎿嶄綔绯荤粺:Linux
鍧楀ぇ灏4096 (log=2)
鍒嗗潡澶у皬=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1966080 inodes, 7864316 blocks
393215 blocks (5.00%) reserved for the super user
绗竴涓暟鎹潡=0
Maximum filesystem blocks=4294967296
240 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000


Checking for bad blocks (read-only test): 瀹屾垚                                
姝e湪鍐欏叆inode琛 瀹屾垚                            
Creating journal (32768 blocks): 瀹屾垚
Writing superblocks and filesystem accounting information: 瀹屾垚


This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@CORPSE2010:WEIHU]# mkdir /mnt/sdb1
[root@CORPSE2010:WEIHU]# mount /dev/sdb1 /mnt/sdb1
[root@CORPSE2010:WEIHU]# df -Th
Filesystem     Type   Size  Used Avail Use% Mounted on
/dev/sda5      ext4   9.5G  5.7G  3.4G  64% /
tmpfs          tmpfs   16G   72K   16G   1% /dev/shm
/dev/sda1      ext4   190M   34M  146M  19% /boot
/dev/sda8      ext4    24G   44M   23G   1% /data
/dev/sda2      ext4   212G  4.0G  197G   2% /home
/dev/sda6      ext4   9.5G  576M  8.5G   7% /opt
/dev/sda7      ext4   9.5G  227M  8.8G   3% /var
/dev/sdb1      ext4    30G   44M   28G   1% /mnt/sdb1
[root@CORPSE2010:WEIHU]# more /etc/fstab


#
# /etc/fstab
# Created by anaconda on Fri May  8 17:04:47 2015
#
# 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=4fc3c61c-35d0-420b-b6d7-f64e5024e564 /                       ext4    defaults        1 1
UUID=978a98e0-7c14-4dd4-94cb-8c4c98652b00 /boot                   ext4    defaults        1 2
UUID=11f6d932-e0c2-4484-bd2e-ab001c736581 /data                   ext4    defaults        1 2
UUID=77a86bb0-335e-49b4-9be7-5fcb568b04b2 /home                   ext4    defaults        1 2
UUID=b5a201c2-8b44-4194-96fa-adebe93c9a9f /opt                    ext4    defaults        1 2
UUID=f4734300-3968-4560-8f1d-9f9b4ef51ea7 /var                    ext4    defaults        1 2
UUID=79805c84-9a35-47fd-b439-6300cf1a48c6 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


[root@CORPSE2010:WEIHU]# df -lh
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda5       9.5G  5.7G  3.4G  64% /
tmpfs            16G   72K   16G   1% /dev/shm
/dev/sda1       190M   34M  146M  19% /boot
/dev/sda8        24G   44M   23G   1% /data
/dev/sda2       212G  4.0G  197G   2% /home
/dev/sda6       9.5G  576M  8.5G   7% /opt
/dev/sda7       9.5G  227M  8.8G   3% /var
/dev/sdb1        30G   44M   28G   1% /mnt/sdb1
[root@CORPSE2010:WEIHU]# 


[root@CORPSE2010:WEIHU]# umount /dev/sdb1     ----卸载
[root@CORPSE2010:WEIHU]# 
[root@CORPSE2010:WEIHU]# 
[root@CORPSE2010:WEIHU]# 
[root@CORPSE2010:WEIHU]# df -lh
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda5       9.5G  5.7G  3.4G  64% /
tmpfs            16G   72K   16G   1% /dev/shm
/dev/sda1       190M   34M  146M  19% /boot
/dev/sda8        24G   44M   23G   1% /data
/dev/sda2       212G  4.0G  197G   2% /home
/dev/sda6       9.5G  576M  8.5G   7% /opt
/dev/sda7       9.5G  227M  8.8G   3% /var

猜你喜欢

转载自blog.csdn.net/corpse2010/article/details/47811397