2017年(38)
分类: Oracle
2017-12-07 13:48:13
1.當你新加上一塊磁盤后,fdisk可以看到磁盤
[root@linuxmodel ~]# fdisk -l
Disk /dev/sdb: 12.8 GB, 12884901888 bytes
Disk /dev/sdb doesn't contain a valid partition table
說明磁盤沒有備劃分過
[root@linuxmodel ~]#fdisk /dev/sdb
Command (m for help): n --新增
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2 --到時候就是/dev/sdb2
First cylinder (784-1566, default 784): --回車默認從784開始
Using default value 784
Last cylinder or +size or +sizeM or +sizeK (784-1566, default 1566):
--這里可以計算你需要分的空間的大小根據百分比
Command (m for help): w --最后寫入
Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2098 16852153+ 83 Linux
/dev/sda2 2099 3403 10482412+ 83 Linux
/dev/sda3 3404 3785 3068415 82 Linux swap / Solaris
/dev/sda4 3786 3916 1052257+ 5 Extended
/dev/sda5 3786 3916 1052226 83 Linux
Disk /dev/sdb: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 783 6289416 83 Linux
/dev/sdb2 784 1566 6289447+ 83 Linux
2.定義文件類型
[root@linuxmodel ~]# mkfs.ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
786432 inodes, 1572354 blocks
78617 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1610612736
48 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
vi /etc/fstab
第一項 第二項 第三項 第四項 第五項 第六項
/dev/sda1 /u01 ext3 defautlts 0 0
第一項:想要掛載的設備
第二項:掛載點
第三項:掛載格式
第四項:檔案系統參數。
例如:async/sync(是否允許磁片於記憶體中的資料異/同步寫入),auto/noauto(啟動時自動/非自動載入該分區)
,rw/ro(該分區以讀寫/唯讀方式載入),exec/noexec(限制在此檔案系統內是否可以進行“執行”操作),
user/nouser(確定是否允許用戶使用mount命令來載入),suid/nosuid(設置該檔案系統是否允許SUID許可權的存在)
,usrquota(開機檔案系統支援磁片配額模式),grpquota(開機檔案系統對使用者組磁片配額模式的支援),
defautlts(同時具有rw,suid,dev,exec,anto,nouser,async等參數)。
第五項:dump備份命令
第六項:在啟動時是否以fsck檢驗分區(0是不要檢驗,1是要檢驗,2也是要檢驗,不過1會比2早被檢驗。)