LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-24-2007, 01:14 PM   #1
estaltz
LQ Newbie
 
Registered: May 2007
Posts: 1

Rep: Reputation: 0
How do you make a device from a file (+ related)


Hello

Serveral related questions here. If you can answer any one of them please do.

What is the command to create a device from a file (for use as virtual disk)

Is it possible to make a device from a file but have it read it backwards so the first block of the file is the last block of the device? Is it possible to pad it so it ignores the first or last n blocks of the file?

Can you make a device from another device?

Can you make a device appear to be a file? For example an unpartitioned disk drive?


Thanks

Last edited by estaltz; 05-24-2007 at 01:15 PM.
 
Old 05-24-2007, 01:50 PM   #2
FMC
Member
 
Registered: May 2007
Location: São Paulo
Distribution: Gentoo & Debian
Posts: 97

Rep: Reputation: 15
Dependint of the type of you file you can mount it in loopback mode and make a device of it.

Try:
# mount -o loop <your file> <the place you want to mount it>

It does not make a device of a file, but maybe it can help you.

[]´s, FMC!
 
Old 05-25-2007, 04:26 AM   #3
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
I think the original poster might not be up to speed on *nix OS's and files, please go read some tutorials or things, youll probably find it very helpful in the future if your asking these questions now. As it stands, its hard to know what you mean, a device, a file, are they not the same thing?

Virtual disks? Youll need a special device driver in the kernel, unless your refering to the loopback device (already mentioned by FMC, its probably what you ment). The loopback device can mount any file and turns it into a device in /dev (which are devices presented as files, btw), which you can then use to mount the device as a filesystem, the "-o" option to mount takes care of setting up the loopback device, and mounting the file system in one easy command.

Making the file appear as reverse to the loopback device? Never heard of it, nore do i know why anyone would do such a thing. Im sure there is a program that can reverse a file for you, if your current file is already in reverse this would correct it and let you mount it as normal. Perhaps the device-mapper can do what you want? Im not sure.

Making a device from another device? Well, a file is part of the partition, which is part of the harddrive, and both are seen as separate devices in /dev, and you can mount files, so perhaps thats what you ment?

And lastly, this must prove you never read up on anything about *nix. The basic philosophy in supposed to be "everything is a file", true, its gotten lost in the GUI, but the basic system exposes every device as a file in /dev, so yes, its possible to read the harddrive as a flat file, but this is probably a bad idea as i have heard, as drive geometry comes into play that can make such snapshots bad, as simply copying one drive to another without the exact geometry can screw up the filesystem/whatever. Not sure why you would want to do this tho.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
IDE device load failure, hardware of software related? perfectblue Linux - General 2 02-08-2006 01:58 AM
php make error (mysql related) oluckboy Red Hat 1 07-06-2005 10:53 AM
NVIDIA Driver, chmod, and make gconfig (all related) spaceballs Slackware 3 02-23-2005 03:18 PM
Assign one USB-storage device to one device file Misel Linux - Hardware 1 08-28-2004 03:52 AM
related to make config donjuan Linux - Hardware 3 07-23-2004 12:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration