LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   'bs' and 'count' operands in #dd command (https://www.linuxquestions.org/questions/linux-newbie-8/bs-and-count-operands-in-dd-command-4175518450/)

manpreetmails 09-13-2014 06:25 AM

'bs' and 'count' operands in #dd command
 
Hi Frnds,

Can you explain me about 'bs' and 'count' operands in #dd command ?

Code:

dd if=/dev/zero of/home/user1/file1 bs=1024 count=50
Kindly explain me above command. Can bs and count operands be used together? In the above command, it is coping 1024 bytes and 50 blocks from input file ?

JeremyBoden 09-13-2014 08:16 AM

You must specify bs (block size in bytes) and count (number of blocks).
It is likely that a block size which is a multiple of 512 or 4096 is most efficient.
file1 will be 50 kbytes of zeroes.

Note that your command requires an of= parameter - you are missing the '='

Note that dd is considered a highly dangerous command - a small slip can be disastrous.

manpreetmails 09-14-2014 05:22 AM

Thanks for your reply. I understood. I am using it for testing purpose only.

I am trying to set quota for user named "geet".
I have used 'edquota' command for set quota and I used soft limit as 50 and hard limit as 90.
When I executed below command, it did not give me warning message or restrain me from creating file with that size and file is being copied. Can you tell me what could be wrong ?

#dd if=/dev/zero of=/home/geet/testfile bs=1024 count=100

ondoho 09-14-2014 06:02 AM

Quote:

Originally Posted by JeremyBoden (Post 5237233)
You must specify

no, you don't have to.
if you omit bs, dd chooses some default size, if you omit both, dd just keeps on writing til the disk is full. if the input file is endless, like /dev/null.

Quote:

Originally Posted by manpreetmails (Post 5237610)
I am trying to set quota for user named "geet".
I have used 'edquota' command for set quota and I used soft limit as 50 and hard limit as 90.
When I executed below command, it did not give me warning message or restrain me from creating file with that size and file is being copied. Can you tell me what could be wrong ?

this is not specific to dd anymore and you really have to tell us what you're talking about.
my system does not have an "edquota" command.
what are you trying to test/achieve, on what system?
please read the first link in my signature.

JeremyBoden 09-14-2014 09:29 AM

You could install the quota package or use one of the ways in http://www.linuxtopia.org/online_boo...ers.html#Quota

Beryllos 09-14-2014 01:17 PM

Quote:

Originally Posted by manpreetmails (Post 5237610)
Thanks for your reply. I understood. I am using it for testing purpose only.

I am trying to set quota for user named "geet".
I have used 'edquota' command for set quota and I used soft limit as 50 and hard limit as 90.
When I executed below command, it did not give me warning message or restrain me from creating file with that size and file is being copied. Can you tell me what could be wrong ?

#dd if=/dev/zero of=/home/geet/testfile bs=1024 count=100

When you executed that command, were you logged in as geet? I believe the quota is enforced per user or group, not per home directory. If you are logged in as root, try this:
Code:

# su geet
$ dd if=/dev/zero of=/home/geet/testfile bs=1024 count=100

Edit: In case you are not familiar with su, I should mention that you go back with the exit command:
Code:

# whoami
root
# su geet
$ whoami
geet
$ exit
# whoami
root
#


manpreetmails 09-24-2014 02:48 AM

Thanks Beryllos! That helped.
I was not logged in as geet while executing command. Thanks for your help.

Thanks Ondoho for your reply.


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