Monday, August 20, 2012
Criar/Mapear dispositivos RAW
É necessário criar pelo menos uma partição no dispositivo em questão. Eu tive o cuidado de verificar primeiro que dispostivos tinham ou não partições já criadas antes que me enganasse e tentasse mexer na partição do sistema - se bem que o fdisk não me permitiria fazer isso... mas nunca se sabe.
[root@mpf ~]# fdisk -l
Disk /dev/sda: 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: 0x00062207
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 1306 9972736 8e Linux LVM
Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 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/sdb doesn't contain a valid partition table
Parti para a criação duma partição no dispositivo em questão:
[root@mpf ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xec3ca131.
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-783, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-783, default 783):
Using default value 783
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Confirmei o que tinha acabado de fazer:
[root@mpf ~]# fdisk -l
Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 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: 0xec3ca131
Device Boot Start End Blocks Id System
/dev/sdb1 1 783 6289416 83 Linux
Uma última verificação:
[root@mpf ~]# cat /proc/partitions
major minor #blocks name
8 0 10485760 sda
8 1 512000 sda1
8 2 9972736 sda2
8 16 6291456 sdb
8 17 6289416 sdb1
Editei depois o ficheiro /etc/udev/rules.d/60-raw.rules (versão 6.2 do CentOS como podem confirmar no fim, não sei se seria assim nas versões anteriores) e acrescentei a linha a vermelho, fiz um restart e verfiquei que o raw device configurado por mim como /dev/raw/raw1 ainda lá estava.
[root@mpf raw]# cat /etc/udev/rules.d/60-raw.rules
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.
ACTION=="add",KERNEL=="sdb1",RUN+="/bin/raw /dev/raw/raw1 %M %m"
[root@mpf raw]#
[root@mpf raw]# cat /etc/redhat-release
CentOS release 6.2 (Final)
Este tipo de dispositivos são usados em algumas instalações Oracle penso eu... pelo menos é para isso que eu vou configurar uma série de discos assim desta forma.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment