Normal view

There are new articles available, click to refresh the page.
Before yesterdayMain stream

How do APFS volume roles work?

By: hoakley
21 November 2024 at 15:30

Since Catalina and Big Sur, macOS has started up not from a single volume, but a whole boot volume group. Among those are the System and Data volumes, intertwined by their firmlinks, a paired Recovery volume, and hidden volumes for virtual memory swap space and preboot firmware. To help macOS know which is which, each of those has a role assigned. This article explores how that works, how you can hand-craft your own Time Machine backup volume, and wonders what a Sidecar backup is.

Volume roles

Tucked away in the superblock of each APFS volume is an unsigned 16-bit integer setting that volume’s roles, chosen from 18 values ranging from None to Prelogin. Although I’m sure I’ve seen these disclosed in Disk Utility in the past, at the moment it appears the only way to read a volume’s set roles is in the command line, using the diskutil command tool, which can also create roles for a new volume, and change them for existing volumes.

The volume superblock of those that are part of a boot volume group also contains a UUID identifying that group.

Boot disk structures on Intel and Apple silicon Macs differ, as shown in the diagrams below.

BootDiskStructureIntelSeq

That on the internal storage of Intel Macs consists of two partitions, of which only one is an APFS container.

BootDiskStructureMSeq

Apple silicon Macs have three APFS containers, with their own volume groups.

According to Apple’s ageing APFS Reference, now over four years since its last update, roles found in Macs include:

  • System (S), for a bootable system,
  • Data (D), for mutable system components and mutable data,
  • Preboot (B), for boot loader ‘firmware’,
  • Recovery (R), for a Recovery system,
  • VM (V), for virtual memory swap space,
  • Update (E), whose purpose isn’t clear,
  • XART (X), for hardware security on Apple silicon,
  • Hardware (H), for firmware data in iOS, but also present on Apple silicon,
  • Backup (T), for Time Machine backup stores.

There are also some that may not be encountered on Macs:

  • Enterprise (Y), for enterprise-managed data in iOS,
  • Installer (I), for install logs etc.,
  • Sidecar (C), for Time Machine.

Finally, there are three that don’t currently have a documented character code:

  • User, for Home directories,
  • Prelogin, for system data used before login,
  • Baseband, for radio firmware in iOS.

Using volume roles

You can view, set and change volume roles in the diskutil command tool, using its apfs command set. Although not listed now by Disk Utility, the command
diskutil apfs list [containerReference]
displays role information about every volume in the container with the given reference. Omit that option and you’ll get information for containers on all mounted disks. Passing a container reference of disk9, for example, might reveal that volume disk9s1 has a Backup role, when it’s the current Time Machine backup store.

This is potentially useful information when you’re trying to understand some of the complex structures that can occur within containers. If you follow Apple’s advice when creating multiple boot volume groups, you’ll install two or more versions of macOS within the same container. If anything goes wrong with that, then it’s essential to be able to identify which are within each boot volume group, something that should be shown clearly by diskutil apfs list.

When adding a new APFS volume to an existing container using the addVolume command, you can pass an option -role to set its role using the single characters given in the lists above, such as T for a Time Machine backup store. If that option is omitted, then no role is assigned as a default.

You can change the role of an existing APFS volume using the changeVolumeRole (or chrole) verb
diskutil apfs chrole [volumeDevice] [role]
for example,
diskutil apfs chrole disk9s1 T
to set disk9s1 to a Time Machine backup role.

This enables you to investigate how volume roles work.

Investigating backup roles

There are enormous problems in trying to perform surgery on boot volume groups, as you’re unable to pair System and Data volumes with firmlinks, or set the volume group UUID in each volume’s superblock. But there are two roles that merit further investigation, Backup and Sidecar, both apparently for use with Time Machine backup stores. I have seen it suggested that older Time Machine backups are stored on volumes with a Backup role, while newer backups are on those with Sidecar roles. So I created two test volumes, both using case-sensitive APFS, as Time Machine likes.

The Finder displayed the Backup volume using its distinctive icon for Time Machine backup stores, and Time Machine appeared happy to add it as a store, although it would need to change the volume’s permissions to set the User to read-only access.

The Sidecar volume vanished from the Finder’s normal list of mounted volumes, although it remained accessible in /Volumes, which it was shown with the regular volume icon, not that for Time Machine backup stores. That’s very different behaviour from current Time Machine backup stores. There’s another problem with the explanation given for these two roles: older Time Machine backups are made to HFS+ not APFS volumes, which don’t have volume roles at all.

Apple’s other use for the name Sidecar refers to the use of an iPad as a secondary display for a Mac, and doesn’t involve APFS volumes at all. So I’m left wondering whether Sidecar volumes are the unused remains of an old now-abandoned backup project, or the promise of something in the future.

Key point

Discover and investigate APFS volume roles using the diskutil apfs list command, passing the reference to a container, e.g. disk9, if you wish to be more specific.

訓練量,到底怎麼算?

12 July 2021 at 17:28
健身課表/課表中,除了動作選擇外,最重要的就是訓練強度和訓練量了。但訓練量有許多不同的定義,本文即是來解釋訓練量的定義方法及理由(原文請見 ig @vin_training

簡介

訓練量,是大家耳熟能詳的名詞,是安排課表時重要的變因之一。

我自己最初接觸這個名詞時,學到的是「訓練量=次數x組數x重量」。但後來慢慢發現,不是所有人都這樣定義的。

譬如,許多健力、健美課表上的每日「volume」欄位就是指當天的「sets (組數)」。而台灣人應該也不陌生的 Juggernaut Training System 的 「訓練量專家」 Mike Isratel (水肥哥翻譯過他的「練胸完全指南」)也把訓練量定義為組數。

那訓練量到底該怎麼定義呢?本文整理了近幾年的研究並給出我個人的推論,但這並不是學界公認的定義,也不是每個健身者都認同的定義。事實上,有些專家會用更複雜的計算方式來定義訓練量(例如,考慮自覺強度或 1RM 百分比)。

因此本文主要目的是分享訓練量的「簡易定義方式」,以供大家參考,並不是說這就是唯一的正解。

For 肌肉量成長:訓練量=組數

傳統上,我們常用「次數x組數x重量」當作訓練量的定義,但就出現了一個問題:為什麼研究(1)會發現,當訓練量相同時,大重量訓練比小重量訓練能得到更多的肌肉量成長?之後,科學家發現,若把訓練量定義為「達到力竭的組數」的話,大重量訓練就跟小重量訓練有同樣的肌肥大效果(研究2研究3)。

[實際應用]

在設計課表時,訓練量是我們常常要操作或控制的變因。許多人把訓練量視為「次數x組數x重量」,但或許把訓練量視為「足夠難的組數」會是更好的方法。

For 肌力:訓練量=組數

關於訓練量與肌力的研究相對不一致。有研究(45)發現訓練的組數越多,肌力成長就越高;但也有研究(67)得出高組數與低組數對肌力成長的效果沒有差別。

但不變的是,大重量對最大肌力的成長一定比低重量大。此外因重量跟次數是互相影響的,所以大重量必伴隨低次數。因此,以肌力為目標的話,將訓練量定義為「組數」即可。

[實際應用]

若目標是最大肌力,那一定要練大重量(>75% 1RM 夠的重量),且時不時需要練>90% 1RM 的重量。但訓練量是不是重點呢?短期可能不是,因此比賽前減少訓練量是不會影響肌力成長的。但長期而言,因肌肉量愈高則肌力成長的潛力越大,所以高訓練量仍會比較好。

For 熱量消耗:訓練量=次數x組數x重量

當訓練量=「次數x組數x量」時,相同的訓練量會有類似的熱量消耗。

因為熱量消耗取決於做功,而做功等於「力x距離x總次數」。所以在距離相同的情況下(也就是你深蹲不會越蹲越高),熱量消耗就可以用「重量x總次數」來預測,而總次數就是次數x組數。

[實際應用]

如果你重訓的目標就是「熱量消耗」的話,那挑選較輕的重量確實能較有效累積一個訓練日的熱量消耗。但我仍會推薦重訓就以肌力、肌肉量、或肌耐力為目標,熱量方面靠飲食更有效。

另一個能觀察到的現象是,初學者通常深蹲或硬舉個 10 下後仍臉不紅氣不喘,但若是能蹲 200 公斤 10 下的人,蹲完肯定會攤死在地板上,因為熱量消耗實在太大了,所以休息時有氧系統需要火力全開提供能量。

結論

若你想尋求最簡單的方法來追蹤訓練量,那用「組數」算是不錯的選擇。但一組三下 vs 一組 15 下對身體的感覺確實不同,所以心中也要記得「組數」只是個訓練量的估算而已,最終還是要檢測自己的身體反應。

❌
❌