首页 > 代码库 > Linux分区和挂载硬盘

Linux分区和挂载硬盘

分区:

[root@code-svn ~]# fdisk /dev/sdbWARNING: DOS-compatible mode is deprecated. Its strongly recommended to         switch off the mode (command c) and change display units to         sectors (command u).Command (m for help): nCommand action   e   extended   p   primary partition (1-4)p  Partition number (1-4): 1First cylinder (1-5221, default 1): Using default value 1Last cylinder, +cylinders or +size{K,M,G} (1-5221, default 5221): Using default value 5221Command (m for help): wThe 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 1UUID=40b1eb12-d29b-4023-a878-a36d39aa68ba /boot                   ext4    defaults        1 2/dev/mapper/vg_codesvn-lv_swap swap                    swap    defaults        0 0tmpfs                   /dev/shm                tmpfs   defaults        0 0devpts                  /dev/pts                devpts  gid=5,mode=620  0 0sysfs                   /sys                    sysfs   defaults        0 0proc                    /proc                   proc    defaults        0 0/dev/sdb1               /disk01                 ext3    defaults        0 0~