惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cisco Talos Blog
Cisco Talos Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
博客园 - Franky
Hugging Face - Blog
Hugging Face - Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
博客园 - 司徒正美
N
News and Events Feed by Topic
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
Help Net Security
Help Net Security
N
News and Events Feed by Topic
O
OpenAI News
L
LangChain Blog
F
Full Disclosure
A
About on SuperTechFans
The GitHub Blog
The GitHub Blog
GbyAI
GbyAI
Cloudbric
Cloudbric
W
WeLiveSecurity
Application and Cybersecurity Blog
Application and Cybersecurity Blog
罗磊的独立博客
Attack and Defense Labs
Attack and Defense Labs
PCI Perspectives
PCI Perspectives
TaoSecurity Blog
TaoSecurity Blog
AI
AI
有赞技术团队
有赞技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
Cisco Blogs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Apple Machine Learning Research
Apple Machine Learning Research
C
CERT Recently Published Vulnerability Notes
T
The Exploit Database - CXSecurity.com
T
Threatpost
P
Palo Alto Networks Blog
G
GRAHAM CLULEY
Last Week in AI
Last Week in AI
雷峰网
雷峰网
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园 - 聂微东
P
Proofpoint News Feed
Latest news
Latest news
S
SegmentFault 最新的问题
J
Java Code Geeks
T
Threat Research - Cisco Blogs
H
Help Net Security
P
Privacy International News Feed

博客园 - 周国选

SQL数据库中修改表的所有者 Centos下apache默认主页修改 CentOS Apache配置详解 Fotolog 的 Solaris/MySQL 架构 mysql不预读数据库信息(use dbname 更快,不会卡) Linux MySQL主从复制(Replication)配置 MySql常用命令总结 备份MySQL出现Can’t open file when using LOCK TABLES错误 ORACLE常用Script Oracle的特色和选项 Oracle入门--启动和关闭详解 如何在sql*plus中使用方向键和删除键 SQL Plus常用命令 SELinux相关指令工具 在Linux上安装Memcached服务 LINUX常用命令 Linux VI/VIM常用命令 memcached telnet操作 Quartz.NET克隆表达式 - 周国选 - 博客园
llinux mount 新建磁盘到指定目录
周国选 · 2011-09-23 · via 博客园 - 周国选

2011-09-23 16:11  周国选  阅读(1049)  评论()    收藏  举报

因为安装数据库,需要较大的磁盘容量,需要把一块新磁盘挂载到/opt上
1 对磁盘做分区:

root@rac1:/root>fdisk /dev/sdb
The number of cylinders for this disk is set to 182024.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-182024, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-182024, default 182024):
Using default value 182024
Command (m for help): p
Disk /dev/sdb: 1497.1 GB, 1497198755840 bytes
255 heads, 63 sectors/track, 182024 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 182024 1462107748+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

2 创建ext3 文件系统:
root@rac1:/root>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)
182763520 inodes, 365526937 blocks
18276346 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
11155 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, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
3 创建标签
root@rac1:/root>e2label /dev/sdb1 /opt
root@rac1:/root>mount /dev/sdb1 /opt
4 mount 到/opt (如果opt里面有数据,则需要先做备份,mount之后,再拷贝到/opt目录)
root@rac1:/root>df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 9.5G 3.0G 6.1G 33% /
/dev/sda3 4.8G 138M 4.4G 4% /tmp
/dev/sda6 255G 27G 215G 12% /home
/dev/sda1 99M 14M 80M 15% /boot
tmpfs 12G 0 12G 0% /dev/shm
/dev/sdb1 1.4T 198M 1.3T 1% /opt
5 修改/etc/fstab 文件
root@rac1:/root>vi /etc/fstab

LABEL=/ / ext3 defaults 1 1
LABEL=/tmp /tmp ext3 defaults 1 2
LABEL=/home /home ext3 defaults 1 2
LABEL=/boot /boot ext3 defaults 1 2
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-sda5 swap swap defaults 0 0
LABEL=/opt /opt ext3 defaults 1 2

"/etc/fstab" 11L, 761C written
测试:
root@rac1:/root>umount /opt/
root@rac1:/root>df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 9.5G 3.0G 6.1G 33% /
/dev/sda3 4.8G 138M 4.4G 4% /tmp
/dev/sda6 255G 27G 215G 12% /home
/dev/sda1 99M 14M 80M 15% /boot
tmpfs 12G 0 12G 0% /dev/shm
root@rac1:/root>mount -a
root@rac1:/root>df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 9.5G 3.0G 6.1G 33% /
/dev/sda3 4.8G 138M 4.4G 4% /tmp
/dev/sda6 255G 27G 215G 12% /home
/dev/sda1 99M 14M 80M 15% /boot
tmpfs 12G 0 12G 0% /dev/shm
/dev/sdb1 1.4T 198M 1.3T 1% /opt
root@rac1:/root>ls /opt/
lost+found
root@rac1:/root>