1使用fdisk –l 查看磁盘分区状态
[root@rmanoracle ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2349 18868311 83 Linux
/dev/sda2 2350 2610 2096482+ 82 Linux swap / Solaris
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 652 5237158+ 83 Linux
Disk /dev/sdc: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280bytes
Disk /dev/sdc doesn't contain a validpartition table
[root@rmanoracle ~]#
2、将sdc分区
[root@rmanoracle ~]# fdisk /dev/sdc
Device contains neither a valid DOSpartition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes willremain in memory only,
until you decide to write them. After that,of course, the previous
content won't be recoverable.
The number of cylinders for this disk isset to 1305.
There is nothing wrong with that, but thisis larger than 1024,
and could in certain setups cause problemswith:
1) software that runs at boot time (e.g.,old versions of LILO)
2) booting and partitioning software fromother OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partitiontable 4 will be corrected by w(rite)
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibilityflag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOSpartition table
p print the partition table
q quit without saving changes
s create a new empty Sundisklabel
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 (expertsonly)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK(1-1305, default 1305):
Using default value 1305
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@rmanoracle ~]#
3、格式化磁盘
[root@rmanoracle ~]# mkfs.ext3 /dev/sdc1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
1310720 inodes, 2620595 blocks
131029 blocks (5.00%) reserved for thesuper user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments pergroup
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystemaccounting information: done
This filesystem will be automaticallychecked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@rmanoracle ~]#
4、创建目录并将/dev/sdc1挂载到该目录下
[root@rmanoracle ~]# mkdir /tmp2
[root@rmanoracle /]# mount /dev/sdc1 /tmp2
[root@rmanoracle /]#
[root@rmanoracle /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 18G 15G 1.9G 89% /
tmpfs 506M 0 506M 0% /dev/shm
/dev/sdb1 5.0G 4.7G 6.9M 100% /backup
/dev/sdc1 9.9G 151M 9.2G 2% /tmp2
[root@rmanoracle /]#
5、设置开机自动挂载
[root@rmanoracle /]# vi /etc/fstab
LABEL=/ / ext3 defaults 1 1
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
LABEL=SWAP-sda2 swap swap defaults 0 0
/dev/sdb1 /backup ext3 defaults 0 1
/dev/sdc1 /tmp2 ext3 defaults 0 0
~
"/etc/fstab" 8L, 589C written
[root@rmanoracle /]#
6、重启系统并验证是否自动挂载
[root@rmanoracle /]# reboot
Broadcast message from root (pts/1) (TueFeb 25 17:56:31 2014):
The system is going down for reboot NOW!
[root@rmanoracle /]#
[root@rmanoracle ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 18G 15G 1.9G 89% /
tmpfs 506M 0 506M 0% /dev/shm
/dev/sdb1 5.0G 4.7G 6.9M 100% /backup
/dev/sdc1 9.9G 151M 9.2G 2% /tmp2
[root@rmanoracle ~]#