趁年轻还记得这些简单命令,做个小记录,等老的想不起来的时候再来看。
环境:Oracle linux 6.3
一。查看现在的分区及文件系统
[root@OEL63 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_oel63-lv_root
18G 11G 5.9G 65% /
tmpfs 496M 375M 121M 76% /dev/shm
/dev/sda1 485M 55M 405M 12% /boot
[root@OEL63 ~]#
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: 0x000cd5a1
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 1959 15215616 8e Linux LVM
/dev/sda3 1959 2610 5236185 8e Linux LVM
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 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: 0x3d49ddef
Device Boot Start End Blocks Id System
/dev/sdb1 1 130 1044193+ 83 Linux
Disk /dev/sdc: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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/vg_oel63-lv_root: 18.9 GB, 18857590784 bytes
255 heads, 63 sectors/track, 2292 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/vg_oel63-lv_swap: 2080 MB, 2080374784 bytes
255 heads, 63 sectors/track, 252 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@OEL63 ~]#
fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xcb0d4a1a.
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):
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, +cylinders or +size{K,M,G} (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@OEL63 ~]#
mkfs -t ext4 /dev/sdc1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2620595 blocks
131029 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 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
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
三。挂载到具体目录
[root@OEL63 ~]#
mkdir /data01
[root@OEL63 ~]#
mount /dev/sdc1 /data01
[root@OEL63 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_oel63-lv_root
18G 11G 5.9G 65% /
tmpfs 496M 375M 121M 76% /dev/shm
/dev/sda1 485M 55M 405M 12% /boot
/dev/sdc1 9.9G 151M 9.2G 2% /data01
[root@OEL63 ~]#
vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Tue Aug 20 00:50:32 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
#
/dev/mapper/vg_oel63-lv_root / ext4 defaults 1 1
UUID=c7219271-21be-4f0c-bc21-0dce3d881129 /boot ext4 defaults 1 2
/dev/mapper/vg_oel63-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/sdc1 /data01 ext4 defaults 1 1
~
~