Guest User

Untitled

a guest
Jan 23rd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. printf "BIL" > /tmp/BIL
  2.  
  3. dd of=/tmp/sparse bs=1 count=0 seek=10
  4. dd if=/tmp/BIL of=/tmp/sparse bs=1 count=3 seek=10
  5.  
  6. dd if=/tmp/BIL of=/tmp/sparse bs=1 count=3 seek=17
  7.  
  8. dd of=/tmp/sparse bs=1 count=0 seek=30
  9. dd if=/tmp/BIL of=/tmp/sparse bs=1 count=3 seek=30
  10.  
  11. %>hexdump sparse
  12. 0000000 0000 4942 004c 0000 0000 4942 004c 0000
  13. 0000010 4200 4c49 0000 0000 0000 0000 0000 4942
  14. 0000020 004c
  15. 0000021
  16.  
  17. %>cat sparse
  18. BILBILBILBIL%
  19.  
  20. %>ls -ls /tmp/sparse
  21. 8.0K -rw-r--r--. 1 bil bil 33 May 26 14:17 /tmp/sparse
  22.  
  23. %>dd of=/tmp/sparse bs=1 count=0 seek=5
  24. %>hexdump sparse
  25. 0000000 0000 4942 004c
  26. 0000005
  27.  
  28. dd if=/tmp/BIL of=/tmp/sparse seek=1000
  29. ls -ls /tmp/sparse
  30.  
  31. st_size; /* total size, in bytes */
  32. blkcnt_t st_blocks; /* number of 512B blocks allocated */
  33.  
  34. $ sudo hdparm --fibmap ~/sparse
  35. filesystem blocksize 4096, begins at LBA 25167872; assuming 512 byte sectors.
  36. byte_offset begin_LBA end_LBA sectors
  37. 512000 226080744 226080751 8
  38.  
  39. $ sudo debugfs /dev/sda3
  40. debugfs: stat <1040667>
  41. Inode: 1040667 Type: regular Mode: 0644 Flags: 0x0
  42. Generation: 1161905167 Version: 0x00000000
  43. User: 127 Group: 500 Size: 335360
  44. File ACL: 0 Directory ACL: 0
  45. Links: 1 Blockcount: 664
  46. Fragment: Address: 0 Number: 0 Size: 0
  47. ctime: 0x4dd61e6c -- Fri May 20 09:55:24 2011
  48. atime: 0x4dd61e29 -- Fri May 20 09:54:17 2011
  49. mtime: 0x4dd61e6c -- Fri May 20 09:55:24 2011
  50. Size of extra inode fields: 4
  51. BLOCKS:
  52. (0-11):4182714-4182725, (IND):4182726, (12-81):4182727-4182796
  53. TOTAL: 83
  54.  
  55. $ dd of=/var/tmp/sparse if=/dev/zero count=1
  56. $ dd of=/var/tmp/sparse if=/dev/zero seek=1000 count=1
  57. $ filefrag -v /var/tmp/sparse
  58. Filesystem type is: ef53
  59. File size of /var/tmp/sparse is 512512 (126 blocks of 4096 bytes)
  60. ext: logical_offset: physical_offset: length: expected: flags:
  61. 0: 0.. 0: 3441408.. 3441408: 1:
  62. 1: 125.. 125: 3441533.. 3441533: 1: 3441409: last,eof
  63. /var/tmp/sparse: 2 extents found
Add Comment
Please, Sign In to add comment