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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 周国选

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  周国选  阅读(1045)  评论()    收藏  举报

因为安装数据库,需要较大的磁盘容量,需要把一块新磁盘挂载到/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>