terça-feira, 16 de novembro de 2010

Linux Hard Disk Format Command


Linux Hard Disk Format Command

Step #1 : Partition the new disk using fdisk command

Following command will list all detected hard disks:
# fdisk -l | grep '^Disk'
Output:
Disk /dev/sda: 251.0 GB, 251000193024 bytes
Disk /dev/sdb: 251.0 GB, 251000193024 bytes
A device name refers to the entire hard disk. For more information see Linux partition naming convention and IDE drive mappings.
To partition the disk - /dev/sdb, enter:
# fdisk /dev/sdb
The basic fdisk commands you need are:
  • m - print help
  • p - print the partition table
  • n - create a new partition
  • d - delete a partition
  • q - quit without saving changes
  • w - write the new partition table and exit

Step#2 : Format the new disk using mkfs.ext3 command

To format Linux partitions using ext2fs on the new disk:
# mkfs.ext3 /dev/sdb1

Step#3 : Mount the new disk using mount command

First create a mount point /disk1 and use mount command to mount /dev/sdb1, enter:
# mkdir /disk1
# mount /dev/sdb1 /disk1
# df -H

Step#4 : Update /etc/fstab file

Open /etc/fstab file, enter:
# vi /etc/fstab
Append as follows:
/dev/sdb1               /disk1           ext3    defaults        1 2
Save and close the file.

Task: Label the partition

You can label the partition using e2label. For example, if you want to label the new partition /backup, enter
# e2label /dev/sdb1 /backup
You can use label name insted of partition name to mount disk using /etc/fstab:
LABEL=/backup /disk1 ext3 defaults 1 2

Referencia:
http://www.cyberciti.biz/faq/linux-disk-format/

quinta-feira, 12 de agosto de 2010

Database File System

Database File System cria File System dentro de tabelas do Oracle que armazenam em formato de Oracle Secure Files LOBs. Acesso ao FS é utilizado via client, dbfs_client, o client é instalado por default no server e pode também ser instalado no client, permitindo acesso remoto. DBFS é suportado somente em linux e solaris, ele utiliza o FUSE Project, o qual é similar a um NTF, porém com a camada de Banco de dados.

Configurando o Oracle.

Deve-se criar um usuário e tablespace para o DBFS, o usuário em questão deve ter também o grant de dbfs_role.
Para criar o FS na tablespace deve ser executado o dbfs_create_filesystem.sql com o usuario com grant de dbfs_role.

CONN / AS SYSDBA

CREATE TABLESPACE dbfs_ts
DATAFILE SIZE 1M AUTOEXTEND ON NEXT 1M;

CONN / AS SYSDBA

CREATE USER dbfs_user IDENTIFIED BY oracle
DEFAULT TABLESPACE dbfs_ts QUOTA UNLIMITED ON dbfs_ts;

GRANT CREATE SESSION, RESOURCE, CREATE VIEW, DBFS_ROLE TO dbfs_user;

cd $ORACLE_HOME/rdbms/admin
sqlplus dbfs_user/dbfs_user

SQL> @dbfs_create_filesystem.sql dbfs_ts staging_area

Instalando o FUSE

# yum install kernel-devel
# yum install fuse fuse-libs

Montando o FS.

O aplicativo dbfs_client é utlizado para montar o FS.

Primeiro montamos o FS no so como root:

# mkdir /mnt/dbfs
# chown oracle:oinstall /mnt/dbfs

# echo "/usr/local/lib" >> /etc/ld.so.conf.d/usr_local_lib.conf# export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
# ln -s $ORACLE_HOME/lib/libclntsh.so.11.1 /usr/local/lib/libclntsh.so.11.1
# ln -s $ORACLE_HOME/lib/libnnz11.so /usr/local/lib/libnnz11.so
# ln -s /lib64/libfuse.so.2 /usr/local/lib/libfuse.so.2

# ldconfig

E para montar o FS com o banco utlizamos o dbfs_client:

$ # Connection prompts for password and holds session.
$ dbfs_client dbfs_user@DB11G /mnt/dbfs

$ # Connection retrieves password from file and releases session.
$ nohup dbfs_client dbfs_user@DB11G /mnt/dbfs < passwordfile.f &

$ # Connection authenticates using wallet and releases session.
$ nohup dbfs_client -o wallet /@DB11G_DBFS_USER /mnt/dbfs &

$ ls -al /mnt/dbfs
total 8
drwxr-xr-x 3 root root 0 Jan 6 17:02 .
drwxr-xr-x 3 root root 4096 Jan 6 14:18 ..
drwxrwxrwx 3 root root 0 Jan 6 16:37 staging_area
$ ls -al /mnt/dbfs/staging_area
total 0
drwxrwxrwx 3 root root 0 Jan 6 16:37 .
drwxr-xr-x 3 root root 0 Jan 6 17:02 ..
drwxr-xr-x 7 root root 0 Jan 6 14:00 .sfs
$