Guest User

Untitled

a guest
Jun 12th, 2012
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #!/bin/bash
  2. clear
  3. echo "-----------------------------------"
  4. echo "removing old file..."
  5. rm -f hdd.im
  6.  
  7. echo "creating 500mb image"
  8. dd if=/dev/zero of=hdd.img bs=516096c count=1000
  9.  
  10. echo "use o (create new table), n (new partition, primary, 1), a (set bootable), t (set type), p (print table), w (save)"
  11. echo "when printing the table, note the start and blocks numbers"
  12. fdisk -u -C1000 -S63 -H16 hdd.img
  13.  
  14. echo "losetup, number is start*512"
  15. losetup -o1048576 /dev/loop0 hdd.img
  16.  
  17. echo "make fat32-fs, number is blocks"
  18. mkdosfs -F32 /dev/loop0 502976
  19.  
  20. echo "trying to mount"
  21. mount -t vfat /dev/loop0 /media/hdd
  22.  
  23. echo "putting files onto image!"
  24. touch /media/hdd/abc.txt
  25. echo "mooo" >> /media/hdd/abc.txt
  26. mkdir /media/hdd/some_test_dir
  27.  
  28. echo "unmounting"
  29. umount /dev/loop0
  30. losetup -d /dev/loop0
  31. losetup -d /dev/loop0
  32. losetup -d /dev/loop0
Advertisement
Add Comment
Please, Sign In to add comment