Advertisement
Guest User

Untitled

a guest
Jul 25th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. cas cas$ df
  2. Filesystem 512-blocks Used Avail Capacity Mounted on
  3. /dev/disk0s3 58342896 49924456 7906440 86% /
  4. devfs 194 194 0 100% /dev
  5. fdesc 2 2 0 100% /dev
  6. <volfs> 1024 1024 0 100% /.vol
  7. automount -nsl [166] 0 0 0 100% /Network
  8. automount -fstab [170] 0 0 0 100% /automount/Servers
  9. automount -static [170] 0 0 0 100% /automount/static
  10. /dev/disk2s1 163577856 23225520 140352336 14% /Volumes/Snapshot
  11. /dev/disk2s2 409404102 5745938 383187960 1% /Volumes/Sparse
  12. cas cas$ mount
  13. /dev/disk0s3 on / (local, journaled)
  14. devfs on /dev (local)
  15. fdesc on /dev (union)
  16. <volfs> on /.vol
  17. automount -nsl [166] on /Network (automounted)
  18. automount -fstab [170] on /automount/Servers (automounted)
  19. automount -static [170] on /automount/static (automounted)
  20. /dev/disk2s1 on /Volumes/Snapshot (local, nodev, nosuid, journaled)
  21. /dev/disk2s2 on /Volumes/Sparse (asynchronous, local, nodev, nosuid)
  22.  
  23. cas cas$ df | grep -e/
  24. | awk '{print $NF}'
  25. | while read line; do echo $line $(stat -f"%Sdr" $line); done
  26. / disk0s3r
  27. /dev ???r
  28. /dev ???r
  29. /.vol ???r
  30. /Network ???r
  31. /automount/Servers ???r
  32. /automount/static ???r
  33. /Volumes/Snapshot disk2s1r
  34. /Volumes/Sparse disk2s2r
  35.  
  36. d
  37.  
  38. df | grep -e/ | awk '{print $NF}' | while read line; do echo "$line" "$(stat -f%Sd "$line"); done
  39.  
  40. df | tail +2 | awk '{print $NF}' | xargs stat -f'%N %Sd %d'
  41.  
  42. df | tail +2 | awk '{print $NF}' | xargs stat -f'%N %Sd %d' |
  43. awk 'BEGIN{f=2^24} {$(NF+1) = int($NF/f) "," ($NF%f) } 1'
  44.  
  45. mountz | xargs -0 stat -f'%N %Sd %d' |
  46. awk 'BEGIN{f=2^24} {$(NF+1) = int($NF/f) "," ($NF%f) } 1'
  47.  
  48. #include <sys/mount.h>
  49. #include <stdio.h>
  50. #include <stdlib.h>
  51.  
  52. /* usage: mountz | xargs -0 command_for_each_mount_point */
  53.  
  54. int main(int argc, const char *argv[]) {
  55. struct statfs *buf;
  56. int flags = MNT_NOWAIT, num_fs, num_stat, i;
  57. unsigned bufsz;
  58.  
  59. num_fs = getfsstat(NULL, 0, flags);
  60. if (num_fs < 0) {
  61. perror("unable to count mounted filesystems: getfsstat");
  62. exit(1);
  63. }
  64.  
  65. bufsz = sizeof(*buf) * num_fs;
  66. buf = malloc(bufsz);
  67. if (!buf) {
  68. perror("unable to allocate %u statfs structs");
  69. exit(1);
  70. }
  71. fprintf(stderr, "p=%pn", buf);
  72.  
  73. num_stat = getfsstat(buf, bufsz, flags);
  74. if (num_stat < 0) {
  75. perror("unable to getfsstat");
  76. exit(1);
  77. }
  78. if (num_stat != num_fs) {
  79. fprintf(stderr, "Hmm, expected %u, got %d.n", num_fs, num_stat);
  80. }
  81.  
  82. for (i = 0; i < num_stat; i++) {
  83. fprintf(stdout, "%s%c", buf[i].f_mntonname, 0);
  84. }
  85. }
  86.  
  87. df | grep -e/ | awk '{print $NF}' | while read line; do echo $line $(stat -f"%Sd" $line); done
  88. / disk0s2
  89. /dev XGS bin tmp
  90. /net XGS bin tmp
  91. /home XGS bin tmp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement