Linux分区和挂载硬盘

分区:

[root@code-svn ~]# fdisk /dev/sdb

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): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-5221, default 5221): 
Using default value 5221

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

Calling ioctl() to re-read partition table.
Syncing disks.

格式化:

[root@code-svn ~]# mkfs -t ext3 /dev/sdb1

查看硬盘:

[root@code-svn ~]# fdisk -l

挂载:

[root@code-svn ~]# mkdir /disk01
[root@code-svn ~]# mount /dev/sdb1 /disk01/

开机挂载:

root@code-svn ~]# vi /etc/fstab 
#
# /etc/fstab
# Created by anaconda on Tue Jul  8 17:41:53 2014
#
# 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
#
/dev/mapper/vg_codesvn-lv_root /                       ext4    defaults        1 1
UUID=40b1eb12-d29b-4023-a878-a36d39aa68ba /boot                   ext4    defaults        1 2
/dev/mapper/vg_codesvn-lv_swap 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 /disk01 ext3 defaults 0 0
~

 

 

 

你可能感兴趣的:(linux)