- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: losetup at boot using udev?
Operating System - Linux
1753367
Members
4974
Online
108792
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2010 10:56 PM
02-13-2010 10:56 PM
losetup at boot using udev?
Hi,
When I setup raw devices in udev for Oracle, I use something like this
ACTION=="add", KERNEL=="sdd1", RUN+="/bin/raw /dev/raw/raw1 %N"
KERNEL="sdd1", OWNER="root", GROUP="oinstall", MODE="0640"
KERNEL=="raw[1-2]", OWNER="root", GROUP="oinstall", MODE="0640"
I'm now trying to do a similar thing with losetup and loopN devices (i.e. I made some fake raw disk by using dd and now I want to set these files up as "raw devices" at boot), so I (probably naively) imagined I could do this similar to the above commands, adding in at the beginning a udev command to associate the dd-created files with the loop device, then follow with the usual raw commands, i.e.
ACTION=="add", KERNEL=="loop1", RUN+="/sbin/losetup /u01/oradata/asmdisks/asmdisk1 %N"
ACTION=="add", KERNEL=="loop1", RUN+="/usr/bin/raw /dev/raw/raw1 %N"
KERNEL="loop1", OWNER="oracle", GROUP="oinstall", MODE="0660"
for the first command I also tried
ACTION=="add", KERNEL=="/u01/oradata/asmdisks/asmdisk1", RUN+="/sbin/losetup /dev/loop1 %N"
so as you can see not entirely sure I fully understand what needs to happen here. I read this:
http://www.reactivated.net/writing_udev_rules.html
but I still could not see where (or even if) losetup and loopN device can be handled in udev?
but it doesn't work the way I thought it might - no raw devices get setup upon boot.
How this could be accomplished at boot time?
I do it manually as follows:
losetup /dev/loop1 /u01/oradata/asmdisks/asmdisk1
raw /dev/raw/raw1 /dev/loop1
chown oracle:dba /dev/raw/raw1
chmod 660 /dev/raw/raw1
it "seems" like their ought to be a way to do this with udev - rather than using a script or rc.local, etc.
Thank You,
Gil
When I setup raw devices in udev for Oracle, I use something like this
ACTION=="add", KERNEL=="sdd1", RUN+="/bin/raw /dev/raw/raw1 %N"
KERNEL="sdd1", OWNER="root", GROUP="oinstall", MODE="0640"
KERNEL=="raw[1-2]", OWNER="root", GROUP="oinstall", MODE="0640"
I'm now trying to do a similar thing with losetup and loopN devices (i.e. I made some fake raw disk by using dd and now I want to set these files up as "raw devices" at boot), so I (probably naively) imagined I could do this similar to the above commands, adding in at the beginning a udev command to associate the dd-created files with the loop device, then follow with the usual raw commands, i.e.
ACTION=="add", KERNEL=="loop1", RUN+="/sbin/losetup /u01/oradata/asmdisks/asmdisk1 %N"
ACTION=="add", KERNEL=="loop1", RUN+="/usr/bin/raw /dev/raw/raw1 %N"
KERNEL="loop1", OWNER="oracle", GROUP="oinstall", MODE="0660"
for the first command I also tried
ACTION=="add", KERNEL=="/u01/oradata/asmdisks/asmdisk1", RUN+="/sbin/losetup /dev/loop1 %N"
so as you can see not entirely sure I fully understand what needs to happen here. I read this:
http://www.reactivated.net/writing_udev_rules.html
but I still could not see where (or even if) losetup and loopN device can be handled in udev?
but it doesn't work the way I thought it might - no raw devices get setup upon boot.
How this could be accomplished at boot time?
I do it manually as follows:
losetup /dev/loop1 /u01/oradata/asmdisks/asmdisk1
raw /dev/raw/raw1 /dev/loop1
chown oracle:dba /dev/raw/raw1
chmod 660 /dev/raw/raw1
it "seems" like their ought to be a way to do this with udev - rather than using a script or rc.local, etc.
Thank You,
Gil
If I could take one thing with me into the next world it would be my valid login to HP ITRC Forums
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2010 08:48 AM
02-14-2010 08:48 AM
Re: losetup at boot using udev?
ok well update to my (probably idiotic) above post, but I think the second step in the manual steps above, i.e. "raw /dev/raw/raw1 /dev/loop1" is probably uneccessary?? The device /dev/loop1 is already a "raw" disk (i.e. can do fdisk /dev/loop1) and see that there are no partitions yet defined, i.e.
[root@rac1 rules.d]# fdisk /dev/loop1
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. 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)
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): p
Disk /dev/loop1: 512 MB, 512000000 bytes
255 heads, 63 sectors/track, 62 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): q
[root@rac1 rules.d]#
So therefore I should be able to just reference /dev/loop1 directly from ASM - with no need to even bother with hooking things up to "/dev/raw" so maybe I do not even need that step - then if that is the case I just need to figure out how to code step 1,
losetup /dev/loop1 /u01/oradata/asmdisks/asmdisk1
into udev
things that make you go hmmmm.....
[root@rac1 rules.d]# fdisk /dev/loop1
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. 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)
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): p
Disk /dev/loop1: 512 MB, 512000000 bytes
255 heads, 63 sectors/track, 62 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): q
[root@rac1 rules.d]#
So therefore I should be able to just reference /dev/loop1 directly from ASM - with no need to even bother with hooking things up to "/dev/raw" so maybe I do not even need that step - then if that is the case I just need to figure out how to code step 1,
losetup /dev/loop1 /u01/oradata/asmdisks/asmdisk1
into udev
things that make you go hmmmm.....
If I could take one thing with me into the next world it would be my valid login to HP ITRC Forums
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP