LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-14-2010, 10:25 PM   #1
Zepx
LQ Newbie
 
Registered: Apr 2010
Posts: 10

Rep: Reputation: 0
Disk Dump


Hello,

I'm quite new to linux, but I've managed to grasp some basics.

Now my intention here to create a virtual directory, which I resorted to creating an Image File so that I can mount it and have my folder have a dedicated storage. I will mount this image as a loop device.

Well it's not much of a problem, but I would like to know whether this is suitable

Say I want to create a 25GB Image.
Code:
dd if=/dev/zero of=/home/disk-img/25GB.ext3 bs=1G count=25
Is this recommended? I'm using block size as 1G which is really huge, so I was wondering, if this is actually recomended. From what I read, some said that it's only advisable to use 4096k or lower, but waht I found was that these suggestions are very dated (year 2003), and it is now 2010, so I would like to know if it makes any big differences.

Regards,
Zepx
 
Old 04-14-2010, 11:35 PM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
So if you want to store a file that's 25MB you are happy to waste the other 975MB of disk space on it are you ?

http://linux.about.com/od/lsa_guide/a/gdelsa35t04.htm

In other words, storing 25 tiny 1k files will fill that whole filesystem.

Last edited by smoker; 04-14-2010 at 11:49 PM.
 
Old 04-14-2010, 11:37 PM   #3
Zepx
LQ Newbie
 
Registered: Apr 2010
Posts: 10

Original Poster
Rep: Reputation: 0
What do you mean that I would waste 975MB when I store 25MB? The image disk would definitely be utilized and used up all 25GB.

In fact after mkfs.ext3 on the image, I got about 24.6GB of Free space.

Last edited by Zepx; 04-14-2010 at 11:39 PM.
 
Old 04-15-2010, 12:17 AM   #4
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
Each file uses at least one block. No matter how small the file is.
It's academic anyway because ext3 doesn't support bigger than 4k blocks.
 
Old 04-15-2010, 12:36 AM   #5
bakdong
Member
 
Registered: Apr 2009
Posts: 214

Rep: Reputation: 44
I think you misunderstood the question. The OP was talking about the dd command to make the file, nothing about the file system mentioned.

That dd command will fill zeros, 1G at a time, 25 times. I can't see a problem with that, though it might not be the most efficient in terms of speed. You'll only be doing it once anyway.
 
Old 04-15-2010, 12:50 AM   #6
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
I read what he said not what he put in the code section.
His command will work (if it's written correctly), but the assumption that he can use 1GB blocks is still incorrect.
Unless he doesn't know what block size is ...
 
Old 04-15-2010, 12:55 AM   #7
Zepx
LQ Newbie
 
Registered: Apr 2010
Posts: 10

Original Poster
Rep: Reputation: 0
I'm really sorry but I guess I do not understand block size well. All I know is that a block is always 512 bytes. That's all I know, and I can't really find any article on the web that explain clearly what a block size is.

I'm still searching at the moment for a clear explanation and what it should mean....

I stumbled upon a 4096k BS that's why I came here to ask and to get myself clarify.

Sorry for the trouble.
 
Old 04-15-2010, 01:00 AM   #8
bakdong
Member
 
Registered: Apr 2009
Posts: 214

Rep: Reputation: 44
Yes, there is obviously some confusion there over the difference between file system block size and the block size parameter in the dd command. The title was 'Disk Dump' though so it seemed a reasonable assumption that that was the question.

I suspect that the large bs would have to be small enough to be capable of being accomodated in RAM to be of any benefit.

My test just took 6 mins to complete that dd.

Zepx, a block is just a group of things. Unless you put it into context, that is all it is.

(It's no trouble)

Also check man dd or info dd for more info, you'll see there that block size just means 'read BYTES bytes at a time'

Last edited by bakdong; 04-15-2010 at 01:04 AM.
 
Old 04-15-2010, 01:03 AM   #9
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
the bs in your dd command is not setting the block size.
mkfs.ext3 will use default values (4k)
http://linux.die.net/man/8/mkfs.ext3
 
Old 04-15-2010, 01:07 AM   #10
Zepx
LQ Newbie
 
Registered: Apr 2010
Posts: 10

Original Poster
Rep: Reputation: 0
Alright, so smoker, does that mean that the dd I'm using is just to create the size of the image? But for a real ext3 to work, the block size should be a valid number of 1024, 2048 and 4096 bytes?
 
Old 04-15-2010, 01:12 AM   #11
bakdong
Member
 
Registered: Apr 2009
Posts: 214

Rep: Reputation: 44
Quote:
Originally Posted by smoker View Post
the bs in your dd command is not setting the block size.

I guess we'll just have to agree to disagree, smoker!

The info page for dd starts with:

`dd' copies a file (from standard input to standard output, by default)
with a changeable I/O block size, while optionally performing
conversions on it.

So the 'bs' does change the block size, in dd.

(but obviously has nothing to do with the file system block size, the disk format block size, or any other block size)

Maybe the OP does not realize that he won't be able to do anything creative with the mounted image until it has a file system?
 
Old 04-15-2010, 01:17 AM   #12
Zepx
LQ Newbie
 
Registered: Apr 2010
Posts: 10

Original Poster
Rep: Reputation: 0
@bakdong,

I do realise that I cannot mount the image if it does not have a file system... Now I understand things a little...

The filesystem ext3 requires a blocksize that is valid like 1024, 2048, and 4096 or a multiple of it? This is done automatically or optionally via mkfs?

The dd I'm performing is just create an image which is blank/empty since I'm using /dev/zero. So it really has got nothing to do with the filesystem right?

Please correct me if I'm wrong.
 
Old 04-15-2010, 01:21 AM   #13
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
@bakdong

If you read the original message, the OP talks about reading somewhere that the block size should be 4k or lower. That is filesystem block size.

I/O block size in dd is a separate thing, which is where everything gets confused. It has nothing to do with filesystem block size which is what the OP thought he was affecting, and what I was responding to.

@Zepx

Yes that's correct. Max default block size for ext3 is 4096 bytes. dd does not create a filesystem.

You can make bigger blocks but the kernel has to support it, and it does waste space with smaller files.

Last edited by smoker; 04-15-2010 at 01:24 AM.
 
Old 04-15-2010, 01:22 AM   #14
Zepx
LQ Newbie
 
Registered: Apr 2010
Posts: 10

Original Poster
Rep: Reputation: 0
Thank you smoker and bakdong. I'm all cleared up.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Core dump issues. Program crashes but does not generate core dump file sabeel_ansari Programming 1 10-07-2009 04:23 PM
[SOLVED] Which dump and fsck option to use in a second hard disk? jollibee Linux - Newbie 4 07-17-2009 10:26 AM
Core dump is larger than file space left on disk? goodkodiak Linux - Software 2 01-24-2009 12:06 AM
installing FreeBSD on Virtual Box error: "Cannot dump. No dump device defined" Valkyrie_of_valhalla *BSD 4 09-06-2007 04:02 AM
How to forcely dump the history of user commands to the admin dump file. mcp_achindra Linux - Security 1 03-19-2004 12:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:18 PM.

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