1833914 Members
2187 Online
110063 Solutions
New Discussion

Re: About Raw Device

 
SOLVED
Go to solution
Fragon
Trusted Contributor

About Raw Device

I remember I can use a whole disk as a raw device because I always use this command to backup my Sybase DB two years ago:
# dd if=/dev/dsk/c3t5d0 of=/dev/rmt/0m bs=10k
But till now I didn't use raw device at all.
Now I have a question that if a whole disk is to be used as a raw device, should it be added to a VG first? Or just a "pvcreate" is enough?
Is LV necessary for raw device?

Thank you very much!
6 REPLIES 6
Rajeev  Shukla
Honored Contributor
Solution

Re: About Raw Device

Hi,
See when you want to use the whole disk as a RAW device, you dont need to add the disk to any VG or do lvcreate. I use the whole disk as a DBspace for one Informix server and it works fine.

Now the only reason why we need to do add it to a VG and do lvcreate is to use part of that disk, so if you want to use say ony 2GB of 4GB disk then you create LV of 2GB and use it RAW (no need to do newfs etc..)
But you could also create a single LV on the whole disk to use the entire disk..then the question comes why would one do so?

The reason is, by adding teh disk to a VG you keep track of disks a system is using by looking at lvmtab, thats it.

I hope this explains..
Cheers
Rajeev
Steven E. Protter
Exalted Contributor

Re: About Raw Device

Kind of wondering:

Does Sybase support that backup methodology? What I mean is if you have trouble with the database after using this methodology to restore it, will they help you get the database working?

Does it work when the database is open(hot) or just cold(shutdown)?

In general database makers provide supported methodology for backups and restores. Stray at your peril.

To you question: All you need to do is pvcreate, with whole disk methodology. The Database utilities control how the space is chopped up into blocks.

Interested in Pete Randall's take on this since I think he is in an Informix shop.

Good luck,

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Fragon
Trusted Contributor

Re: About Raw Device

To Sritharan, the link you offered give almost no use, but I still thank you very much!
To Rajeev, of course you should get 10 points! You answer is just what I want and I also agree to your idea. But I want to learn more about other guru's advice, I will assign the point later! Thank you very much.

-ux
Fragon
Trusted Contributor

Re: About Raw Device

To Steven:
Great! I really did none restore for this backup, so I assume it work OK at that time.
Now Sybase "game over" in our company! :p

BTW, would anybody succefully create a file system on a disk which belongs to none VG? For example:
# pvcreate -f /dev/rdsk/c3t5d0
# newfs -F vxfs /dev/rdsk/c3t5d0

?

-ux
Steve Lewis
Honored Contributor

Re: About Raw Device

You should use the raw device for direct database storage. This is because it is the only way the database can guarantee that the data has been sent to the device and isn't stuck in UNIX buffers.

You don't have to pvcreate a disk to use it as a raw device. pvcreate is only required to add a disk to a volume group.

But you can still use it to create a filesystem on - this is what we all had to do before logical volume managers like LVM.

See this:

[root]d370:/# newfs /dev/rdsk/c0t14d0
newfs: /etc/default/fs is used for determining the file system type
version 4 layout
4194157 sectors, 4194157 blocks of size 1024, log size 1024 blocks
unlimited inodes, largefiles not supported
4194157 data blocks, 4192013 free data blocks
128 allocation units of 32768 blocks, 32768 data blocks
last allocation unit has 32621 data blocks
[root]d370:/#
[root]d370:/# mkdir /rawdisk
[root]d370:/# mount /dev/dsk/c0t14d0 /rawdisk
[root]d370:/# bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 204800 78696 125152 39% /
/dev/vg00/lvol1 295024 38816 226704 15% /stand
/dev/vg00/lvol8 1048576 321480 722000 31% /var
/dev/vg00/lvol6 1638400 1068120 565840 65% /usr
/dev/vg00/lvol5 409600 9088 397448 2% /tmp
/dev/vg01/lvt 10240000 2601508 7161150 27% /t
/dev/vg00/lvol4 2891776 1602376 1279368 56% /opt
/dev/vg00/lvol7 409600 45368 361448 11% /home
/dev/dsk/c0t14d0 4194157 2128 3930035 0% /rawdisk
[root]d370:/# mount -p
/dev/vg00/lvol3 / vxfs log 0 1
/dev/vg00/lvol1 /stand hfs defaults 0 0
/dev/vg00/lvol8 /var vxfs delaylog 0 0
/dev/vg00/lvol6 /usr vxfs delaylog 0 0
/dev/vg00/lvol5 /tmp vxfs delaylog 0 0
/dev/vg01/lvt /t vxfs delaylog 0 0
/dev/vg00/lvol4 /opt vxfs delaylog 0 0
/dev/vg00/lvol7 /home vxfs delaylog 0 0
/dev/dsk/c0t14d0 /rawdisk vxfs log 0 0