Advertisement
Guest User

apfs space-sharing

a guest
Jun 20th, 2016
958
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. // a quick run-thrgouh of creating two space-sharing volumes on one apfs container
  2.  
  3. // save me a lot of typing
  4. $ alias apfs="diskutil apfs -IHaveBeenWarnedThatAPFSIsPreReleaseAndThatIMayLoseData"
  5.  
  6. // create an apfs image
  7. $ hdiutil create -fs APFS -size 20GB apfs.sparseimage
  8. WARNING: You are using a pre-release version of the Apple File System called
  9. APFS which is meant for evaluation and development purposes only. Files
  10. stored on this volume may not be accessible in future releases of OS X.
  11.  
  12. You should back up all of your data before using APFS and regularly back up
  13. data while using APFS, including before upgrading to future releases of OS X.
  14.  
  15. Continue? [y/N] y
  16. created: /Users/soneil/Desktop/apfs.sparseimage
  17.  
  18. // and attach
  19. $ hdiutil attach apfs.sparseimage
  20. /dev/disk3 GUID_partition_scheme
  21. /dev/disk3s1 EFI
  22. /dev/disk3s2 Apple_APFS
  23. /dev/disk3s2s1 41504653-0000-11AA-AA11-0030654 /Volumes/untitled
  24.  
  25. // note s2s1; disk3s2 is the container, s2s1 is the volume
  26.  
  27. // unmount the volume, but leaving the container attached (not ejected)
  28. $ hdiutil unmount /Volumes/untitled
  29. "/Volumes/untitled" unmounted successfully.
  30. $ diskutil list /dev/disk3
  31. /dev/disk3 (disk image):
  32. #: TYPE NAME SIZE IDENTIFIER
  33. 0: GUID_partition_scheme +21.5 GB disk3
  34. 1: EFI EFI 209.7 MB disk3s1
  35. 2: Apple_APFS 21.3 GB disk3s2
  36.  
  37. /dev/disk3s2s1 (external, virtual):
  38. #: TYPE NAME SIZE IDENTIFIER
  39. 0: APFS Volume untitled +20.5 KB disk3s2s1
  40.  
  41. // add a new volume to the container
  42. $ apfs addVolume disk3s2 APFS SecondVolume
  43. Exporting new shared unencrypted APFS Volume "SecondVolume" from APFS Container Reference disk3s2
  44. Started APFS operation
  45. Adding APFS Volume to APFS Container
  46. Creating APFS Volume
  47. Created new APFS Volume disk3s2s2
  48. Mounting APFS Volume
  49. Finished APFS operation
  50.  
  51. // reattach the original volume
  52. $ hdiutil mount /dev/disk3s2s1
  53. /dev/disk3s2s1 41504653-0000-11AA-AA11-0030654 /Volumes/untitled
  54.  
  55. // and admire the result
  56. $ apfs list
  57.  
  58. ======================================================================================================
  59. ENUMERATION OF ALL CURRENT APFS OBJECTS
  60.  
  61. APFS CONTAINER: REFERENCE: disk3s2 Total Container Size = 21.3 GB (21265080320 Bytes)
  62. | Container Free Space = 21.2 GB (21203574784 Bytes)
  63. |
  64. |--< APFS PHYSICAL STORE: disk3s2
  65. |
  66. |--> APFS VOLUME: disk3s2s1 Volume Name = untitled (/Volumes/untitled)
  67. | Space-Sharing Current Volume Size = 24.6 KB (24576 Bytes)
  68. |
  69. |--> APFS VOLUME: disk3s2s2 Volume Name = SecondVolume (/Volumes/SecondVolume)
  70. | Space-Sharing Current Volume Size = 24.6 KB (24576 Bytes)
  71. |
  72. ======================================================================================================
  73.  
  74. ---------------------------------------------------------------------
  75. APFS OBJECTS BY ITERATING ALL CURRENT DISKS WHILE CHECKING APFS ROLES
  76.  
  77. APFS PHYSICAL STORE = disk3s2 -> APFS CONTAINER REFERENCE = disk3s2
  78. APFS VOLUME = disk3s2s1 -> APFS CONTAINER REFERENCE = disk3s2
  79. APFS VOLUME = disk3s2s2 -> APFS CONTAINER REFERENCE = disk3s2
  80. ---------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement