[cs615asa] How to read data from device

Yifang Yuan yyuan17 at stevens.edu
Thu May 17 09:12:05 EDT 2018


Hi Professor
For this assignment, do we need to partition, format and mount operation?
I encountered this question durning my work. I did some test and checked it on web. I think we don’t need to do all of them, but i use fdisk -l to check the disk is online. 
Is it reasonable or safe?

Yifang

> On May 16, 2018, at 22:47, Jan Schaumann <jschauma at stevens.edu> wrote:
> 
> Zhitao Chen <zchen69 at stevens.edu> wrote:
> 
>> Is anyone know to read data from device? I use dd(1) to try to read the data, e.g.
>> 
>> # dd if=/dev/xbd3a | od -l
> 
> Make sure to use the correct disk device and, if applicable, partition.
> I.e., if you have a disklabled device, then you probably can't use the
> 'a' partition but need to use the full disk partition:
> 
> # tar cvf - . | dd of=/dev/xbd0a
> [...]
> .dd: //dev/xbd0a: Read-only file system
> tar: Failed write to archive volume: 1 (Broken pipe)
> 
> But:
> 
> # tar cvf - . | dd of=/dev/xbd0a
> [...]
> tar: ustar vol 1, 335 files, 0 bytes read, 8478720 bytes written in 5
> secs (1695744 bytes/sec)
> # dd if=/dev/xbd0a | tar tvf -
> 
> will then show your data.
> 
> Be careful to not use e.g. /dev/xbd2 when that is not actually the block
> device in question:
> 
> # tar cvf - . | dd of=/dev/xbd2
> [...] # looks like success
> # ls -l /dev/xbd2
> -rw-r--r--  1 root  wheel  8478720 May 17 02:46 /dev/xbd2
> 
> # whoops, we just created a regular file named "/dev/xbd2" on the root
> # file system
> 
> -Jan
> _______________________________________________
> cs615asa mailing list
> cs615asa at lists.stevens.edu
> https://lists.stevens.edu/mailman/listinfo/cs615asa



More information about the cs615asa mailing list