1752774 Members
4878 Online
108789 Solutions
New Discussion юеВ

Re: dd command

 
study unix
Regular Advisor

dd command

Hi,
I use dd command to copy file system,
why it is successful to run dd when file system is un-mount, but file system is mount that dd is no effect, why? Thanks!
7 REPLIES 7
Torsten.
Acclaimed Contributor

Re: dd command

This is not really true, but if unmounted there are no changes possible during the copy.


IMHO there are better methods for such copy (without knowing your reason for doing this).

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Manix
Honored Contributor

Re: dd command

I am not sure why you used "dd" for this
why didn`t you created a mirror copy or used
a backup utility to do so.

Can you please share what exactly you want to
achieve.

Thanks

Manix
HP-UX been always lovable - Mani Kalra
study unix
Regular Advisor

Re: dd command

HI,
thanks for your response!
I only need copy the whole logical volume to another logical volume, the same output as below between mount and un-mount file system, but it uses bdf to indentify that is sucessfully to complete "dd" for un-mount system
# dd if=/dev/vg01/rlv01 of=/dev/vg02/rlv02 bs=1024

409600+0 records in
409600+0 records out

Another question, when bs=512 found error,why?
# dd if=/dev/vg01/rlv01 of=/dev/vg02/rlv02 bs=512
dd: /dev/vg01/rlv01 Use a blocksize >= the logical block size 1024
root@bandao:/
Hakki Aydin Ucar
Honored Contributor

Re: dd command

unmounted lvol01 means no running system there.
can you issue the command:
# bdf
study unix
Regular Advisor

Re: dd command

Hi,
bdf output as below,
# bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 1048576 235760 806592 23% /
/dev/vg00/lvol1 1835008 183184 1639008 10% /stand
/dev/vg00/lvol8 4915200 1305672 3583744 27% /var
/dev/vg00/lvol7 8388608 3038968 5307920 36% /usr
/dev/vg00/lvol6 1048576 20848 1019704 2% /tmp
/dev/vg00/lvol5 16007168 4612880 11305352 29% /opt
/dev/vg00/lvol4 8388608 21064 8302176 0% /home
/dev/vg01/lv01 409600 2384 381767 1% /test01
/dev/vg02/lv02 409600 2384 381767 1% /test02
Manix
Honored Contributor

Re: dd command


I would expect that it's because the LVM block size is 1K. Even though it's a raw volume, it's *still* an LVM controlled device & is an LV in a VG. It just has no filesystem on it.


Do a man scsi_disk. It will explain that the smallest possible I/O quantity is one logical block. That value is set by the value BLKDEV_IOSIZE which must be >= DEV_BSIZE and <= MAXBSIZE. DEV_BSIZE in /usr/include/sys/param.h is defined as 1024 and that is your answer. Man 7 disk for more details. Remember, logical volume I/O whether conventional LVM or VxVM must ultimately be passed on the to underlying disk I/O routines and thus SCSI I/O defines the limits.


http://h30499.www3.hp.com/t5/LVM-and-VxVM/cannot-write-chunk-less-than-1024-bytes-into-raw-veritas-volume/m-p/3325544#M21178

HP-UX been always lovable - Mani Kalra
study unix
Regular Advisor

Re: dd command

HI Manix,
You are right,and find it from param.h,
but if you can explain when I use dd for mount and un-mount the same file system separately ,and then it uses bdf the outupt is different, why ?


# grep DEV_BSIZE param.h
#define BSIZE DEV_BSIZE
* Note that the blocked devices are assumed to have DEV_BSIZE
* DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE
#ifndef DEV_BSIZE
#define DEV_BSIZE 1024
#define DEV_BSHIFT 10 /* log2(DEV_BSIZE) */
#define DEV_BMASK (DEV_BSIZE-1) /* For doing modulo functions */
#endif /* DEV_BSIZE */
# define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
# define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
# define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
# define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
(((uint64_t)(bytes) + (DEV_BSIZE-1)) >> DEV_BSHIFT) : \
(unsigned)(((uint64_t)(unsigned)(bytes) + (DEV_BSIZE-1)) >> DEV_BSHIFT))
(((unsigned)(bytes) + (DEV_BSIZE-1)) >> DEV_BSHIFT)
* just use DEV_BSIZE.
#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))