<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>.:: Marcos Dione/StyXman's glob ::. (Posts about disks)</title><link>https://www.grulic.org.ar/~mdione/glob/</link><description></description><atom:link href="https://www.grulic.org.ar/~mdione/glob/categories/disks.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2026 &lt;a href="mailto:mdione@grulic.org.ar"&gt;Marcos Dione&lt;/a&gt; </copyright><lastBuildDate>Thu, 01 Jan 2026 15:38:03 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Printing and identifying disks</title><link>https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/</link><dc:creator>Marcos Dione</dc:creator><description>&lt;p&gt;Another short one. Seems like I haven't completed anything interesting lately, but I have a couple of things in the 
burner. Also, this is mostly for remembering this myself, because I always spend 30m to come up with this invocation&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt;.
This is another of those you-wouldn't-need-to-read-this-post-if-you-read-manpages-from-time-to-time posts.&lt;/p&gt;
&lt;p&gt;I have a laptop that's the web/home/media/backup server &lt;em&gt;and&lt;/em&gt; it's the AP. For many reasons, it has 4 disks&lt;sup id="fnref:8"&gt;&lt;a class="footnote-ref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fn:8"&gt;8&lt;/a&gt;&lt;/sup&gt;. I also have 
like 10 other old disks laying around, waiting for the day I buy a not so old tower to replace the laptop (which is... 
13yo). That day, identifying disks will be a &lt;em&gt;necessity&lt;/em&gt;. So far, the best tool I have found that gives me an idea what 
is what is &lt;code&gt;lsblk&lt;/code&gt;, but I'm not satisfied with its default output format:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="n"&gt;mdione&lt;/span&gt;&lt;span class="nv"&gt;@diablo&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lsblk&lt;/span&gt;
&lt;span class="n"&gt;NAME&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="nl"&gt;MAJ&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nf"&gt;MIN&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;RM&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="k"&gt;SIZE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;RO&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;TYPE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;MOUNTPOINTS&lt;/span&gt;
&lt;span class="n"&gt;sdb&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mf"&gt;1.8&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;disk&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;
&lt;span class="err"&gt;└─&lt;/span&gt;&lt;span class="n"&gt;sdb1&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;17&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mf"&gt;1.8&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;part&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;mnt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;trash&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;mdione&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;public_html&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;Pictures&lt;/span&gt;
&lt;span class="w"&gt;                                 &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;home&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;mdione&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;public_html&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;Pictures&lt;/span&gt;
&lt;span class="w"&gt;                                 &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;home&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="k"&gt;backup&lt;/span&gt;
&lt;span class="w"&gt;                                 &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;mnt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="k"&gt;data&lt;/span&gt;
&lt;span class="n"&gt;sdc&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;931.5&lt;/span&gt;&lt;span class="n"&gt;G&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;disk&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;
&lt;span class="err"&gt;├─&lt;/span&gt;&lt;span class="n"&gt;sdc1&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;33&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="n"&gt;G&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;part&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;SWAP&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="err"&gt;└─&lt;/span&gt;&lt;span class="n"&gt;sdc2&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;34&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;915.5&lt;/span&gt;&lt;span class="n"&gt;G&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;part&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;
&lt;span class="n"&gt;sdd&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;48&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;698.6&lt;/span&gt;&lt;span class="n"&gt;G&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;disk&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;
&lt;span class="err"&gt;└─&lt;/span&gt;&lt;span class="n"&gt;sdd1&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;49&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;686.6&lt;/span&gt;&lt;span class="n"&gt;G&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;part&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;home&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;mdione&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;public_html&lt;/span&gt;
&lt;span class="w"&gt;                                 &lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;mnt&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;trash&lt;/span&gt;
&lt;span class="n"&gt;sde&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mf"&gt;1.8&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;disk&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;
&lt;span class="err"&gt;├─&lt;/span&gt;&lt;span class="n"&gt;sde1&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;65&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mf"&gt;23.8&lt;/span&gt;&lt;span class="n"&gt;M&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;part&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;
&lt;span class="err"&gt;├─&lt;/span&gt;&lt;span class="n"&gt;sde2&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;66&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mf"&gt;1.8&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;part&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;
&lt;span class="err"&gt;└─&lt;/span&gt;&lt;span class="n"&gt;sde3&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;67&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mf"&gt;48.8&lt;/span&gt;&lt;span class="n"&gt;G&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;part&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Why? Because I don't care about &lt;code&gt;MAJ:MIN&lt;/code&gt;, but also I need more info: partition table type&lt;sup id="fnref:2"&gt;&lt;a class="footnote-ref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fn:2"&gt;2&lt;/a&gt;&lt;/sup&gt;, device model&lt;sup id="fnref:3"&gt;&lt;a class="footnote-ref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fn:3"&gt;3&lt;/a&gt;&lt;/sup&gt;,
and at least available space&lt;sup id="fnref:4"&gt;&lt;a class="footnote-ref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fn:4"&gt;4&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;Now look at this&lt;sup id="fnref:9"&gt;&lt;a class="footnote-ref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fn:9"&gt;9&lt;/a&gt;&lt;/sup&gt;:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="n"&gt;mdione&lt;/span&gt;&lt;span class="nv"&gt;@diablo&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;lsblk&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;--all --output NAME,TYPE,VENDOR,MODEL,REV,ROTA,HOTPLUG,RO,SIZE,PTTYPE,PARTTYPENAME,PARTUUID,PARTFLAGS,PARTLABEL,FSTYPE,FSSIZE,UUID,FSAVAIL,LABEL,FSROOTS,MOUNTPOINTS&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/lsblk.txt"&gt;This space intentionally left blank&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It &lt;em&gt;is&lt;/em&gt; a lot of info, but:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;NAME: yes, and I love the tree.&lt;/li&gt;
&lt;li&gt;TYPE: OK, this might be extra, but to this day &lt;code&gt;nvme0n1&lt;/code&gt; still feels like a partition, and not a whole device.&lt;/li&gt;
&lt;li&gt;VENDOR: Yeah, OK, this looks useless for internal disks (the other two are connected via USB, see HOTPLUG).&lt;/li&gt;
&lt;li&gt;MODEL: yes, please&lt;/li&gt;
&lt;li&gt;REV: OK, not that I upgrade disk firmware ever...&lt;/li&gt;
&lt;li&gt;ROTA: HDD vs SSD/Flash/NVME&lt;/li&gt;
&lt;li&gt;HOTPLUG: mostly, USB, see VENDOR&lt;sup id="fnref:6"&gt;&lt;a class="footnote-ref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fn:6"&gt;6&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;
&lt;li&gt;RO: maybe useful for RO SDs?&lt;/li&gt;
&lt;li&gt;SIZE: of course. Unluckily I can't find how to ask for a consistent unit (see the G vs M vs T).&lt;/li&gt;
&lt;li&gt;PTTYPE: dos/MBR vs gpt, which is BIOS/legacy vs UEFI.&lt;/li&gt;
&lt;li&gt;PARTTYPENAME: might be misleading, see &lt;code&gt;sdb1&lt;/code&gt;'s and the file system it hosts.&lt;/li&gt;
&lt;li&gt;PARTUUID: Debian refuses to allow specifying root partiition by label, and this machine detects disks in the 'wrong'
  order, rendering it unbootable if I use &lt;code&gt;/dev/sdXY&lt;/code&gt; instead, so this is important&lt;sup id="fnref2:8"&gt;&lt;a class="footnote-ref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fn:8"&gt;8&lt;/a&gt;&lt;/sup&gt;.&lt;/li&gt;
&lt;li&gt;PARTFLAGS: 0x80 is DOS bootable partition, which I need in this non-UEFI machine&lt;sup id="fnref:7"&gt;&lt;a class="footnote-ref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fn:7"&gt;7&lt;/a&gt;&lt;/sup&gt;.&lt;/li&gt;
&lt;li&gt;FSTYPE: of course.&lt;/li&gt;
&lt;li&gt;FSSIZE: ditto&lt;/li&gt;
&lt;li&gt;UUID: see PARTUUID.&lt;/li&gt;
&lt;li&gt;FSAVAIL: of course.&lt;/li&gt;
&lt;li&gt;LABEL: except for &lt;code&gt;/&lt;/code&gt;, I mount by label. Sue me, Debian.&lt;/li&gt;
&lt;li&gt;FSROOTS: My disk usage is weird&lt;sup id="fnref3:8"&gt;&lt;a class="footnote-ref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fn:8"&gt;8&lt;/a&gt;&lt;/sup&gt;. To me it's imporatnt to know what is mounted where. The many entries with non &lt;code&gt;/&lt;/code&gt;
  FSROOTs are bind mounts.&lt;/li&gt;
&lt;li&gt;MOUNTPOINTS: Ditto.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So, in all, this command replaces &lt;code&gt;mount&lt;/code&gt; and even &lt;code&gt;mount -t ext4&lt;/code&gt;, &lt;code&gt;df -h&lt;/code&gt;, &lt;code&gt;fdisk -l&lt;/code&gt;, perusing &lt;code&gt;dmesg&lt;/code&gt; and maybe more.&lt;/p&gt;
&lt;div class="footnote"&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;Yeah, OK, I made a script out of it, OK? And it's now deployed everywhere (2 machines :) via Ansible. &lt;a class="footnote-backref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fnref:1" title="Jump back to footnote 1 in the text"&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:2"&gt;
&lt;p&gt;For when I'm upgrading disks and the new one is not booting or something, like I did recently. &lt;a class="footnote-backref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fnref:2" title="Jump back to footnote 2 in the text"&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:3"&gt;
&lt;p&gt;To identify two very similar disks for said upgrades, or make &lt;em&gt;sure&lt;/em&gt; that &lt;code&gt;/dev/sda&lt;/code&gt; is not the main disk on the 
  machine&lt;sup id="fnref:5"&gt;&lt;a class="footnote-ref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fn:5"&gt;5&lt;/a&gt;&lt;/sup&gt; but a USB pen drive I want to write a rescue image on;  otherwise, I would be &lt;code&gt;/dev[astated]/sad&lt;/code&gt;. &lt;a class="footnote-backref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fnref:3" title="Jump back to footnote 3 in the text"&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:4"&gt;
&lt;p&gt;Who doesn't want to know this, right? &lt;a class="footnote-backref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fnref:4" title="Jump back to footnote 4 in the text"&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:5"&gt;
&lt;p&gt;Since I have a laptop that can handle NVME devices, this has been &lt;code&gt;/dev/nvme0n1&lt;/code&gt;, but almost 3y of novelty can't 
  beat more than two decades of precious &lt;code&gt;/dev/sda&lt;/code&gt;. &lt;a class="footnote-backref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fnref:5" title="Jump back to footnote 5 in the text"&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:6"&gt;
&lt;p&gt;Yes, circular 'see', sue me. &lt;a class="footnote-backref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fnref:6" title="Jump back to footnote 6 in the text"&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:7"&gt;
&lt;p&gt;TBF, this machine supports it, but the hassle it means to activate that now is beyond what I'm prepared to fix. &lt;a class="footnote-backref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fnref:7" title="Jump back to footnote 7 in the text"&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:8"&gt;
&lt;p&gt;Rationale is like this: I have an internal SSD (not NVME, this machine is too old), this is &lt;code&gt;/&lt;/code&gt;; 
  an internal HDD for trash, mainly semi throwaway map tiles
  mounted in my &lt;code&gt;public_html&lt;/code&gt; directory, and it's full; an external HDD, this is for local backup but also serves my 
  pics from a subdir from my &lt;code&gt;public_html&lt;/code&gt;; if I have to run and leave everything behind, this is the first/only 
  thing I pick up; and the external NVME on a USB encasing, which is soon to replace the external HDD. &lt;a class="footnote-backref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fnref:8" title="Jump back to footnote 8 in the text"&gt;↩&lt;/a&gt;&lt;a class="footnote-backref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fnref2:8" title="Jump back to footnote 8 in the text"&gt;↩&lt;/a&gt;&lt;a class="footnote-backref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fnref3:8" title="Jump back to footnote 8 in the text"&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:9"&gt;
&lt;p&gt;Chízus, Nikola completely fsck'd it up. Sorry for the text file. And TBH, this does not even fits my terminal on a 
  170%&lt;sup id="fnref:10"&gt;&lt;a class="footnote-ref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fn:10"&gt;10&lt;/a&gt;&lt;/sup&gt; 3840x2160 27" monitor, but at least looks fine in my navigator. &lt;a class="footnote-backref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fnref:9" title="Jump back to footnote 9 in the text"&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:10"&gt;
&lt;p&gt;I'm old, OK? &lt;a class="footnote-backref" href="https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/#fnref:10" title="Jump back to footnote 10 in the text"&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description><category>disks</category><category>sysadmin</category><guid>https://www.grulic.org.ar/~mdione/glob/posts/printing-and-identifying-disks/</guid><pubDate>Thu, 01 Jan 2026 13:41:06 GMT</pubDate></item><item><title>Recovering partitions with pen and paper</title><link>https://www.grulic.org.ar/~mdione/glob/posts/recovering-partitions-with-pen-and-paper/</link><dc:creator>Marcos Dione</dc:creator><description>&lt;p&gt;&lt;em&gt;Note: this is a translation of an old post. I decided to translate it because
now I'm looking for a SysAdmin position (tell your friends!) and I would like
this post to show how I work.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Last Saturday I received an email from one of the guys from work with the
subject «urgennnnnnnnt: heeeeeeeeeelp»[sic]. He says he was idling on Friday
night when his machine stopped emiting sound via the soundcard and then it behaved
erratically. When he tried rebooting it, it didn't boot anymore. «It says
something about disk not bootable...».&lt;/p&gt;
&lt;p&gt;Monday morning I go to work and go to see the machine. Precisely, it said
something about «disk not bootable». I boot with a USB key with
&lt;a href="http://grml.org/"&gt;GRML&lt;/a&gt; and I find that the disk has no partitions.&lt;/p&gt;
&lt;p&gt;Panic.&lt;/p&gt;
&lt;p&gt;The guy is doing a PostDoc in something astronomical (literally) and all his
work is in that machine. No backups, as usual, so I prepare myself to rescue
the partitions.&lt;/p&gt;
&lt;p&gt;In that same USB key I have a system with
&lt;a href="http://www.gnu.org/software/parted/"&gt;parted&lt;/a&gt;. I boot with it and I try using
&lt;code&gt;parted&lt;/code&gt;'s rescue tool. Nothing. I ask the guy how the disk was partitioned, etc.
He tells me that he only installed Kubuntu clicking 'Next'. Kubuntu by default
creates a swap partition and an ext3 partition for / and that's it, which made
what was coming relatively easy.&lt;/p&gt;
&lt;p&gt;I reboot in GRML and I use &lt;code&gt;hexdump -C /dev/sda | more&lt;/code&gt; to see the disk's
content. This is not the first time that I juggle with partitions and MBRs,
but last time I did it, I used a tool that is now discontinued (the tool was
called DiskEdit, included in The Norton Utilities), which had special edit modes
for MBRs, FATs, and a lot of useful things... in MS universe.&lt;/p&gt;
&lt;p&gt;First I confirm that, yes, the first sector is a MBR (at least it has the
&lt;code&gt;0x55aa&lt;/code&gt; signature at the end), and that the whole &lt;a href="http://en.wikipedia.org/wiki/Mbr#MBRs_and_disk_partitioning"&gt;partition
table&lt;/a&gt; is empty,
but in the second sector of the disk there seems to be a copy. I take pen and
paper, write down what I found, but it turns out not only I have half the data,
the partition I thought I found was too small.&lt;/p&gt;
&lt;p&gt;So I decide to look for the partition by hand. To do that I needed to find out
first how does the ext3 kernel code know wether a partition is ext3 or not.
I knew it would be some kind of magic signature, but I had no idea which. So I
installed the sources for 2.6.29 in my laptop and started to look at ext3's
code. After going around a lot, including reading the code that is excuted when
you &lt;a href="http://lxr.linux.no/linux+v2.6.29/fs/super.c#L917"&gt;mount&lt;/a&gt;
&lt;a href="http://lxr.linux.no/linux+v2.6.29/fs/super.c#L779"&gt;a&lt;/a&gt;
&lt;a href="http://lxr.linux.no/linux+v2.6.29/fs/super.c#L357"&gt;filesystem&lt;/a&gt; of type
&lt;a href="http://lxr.linux.no/linux+v2.6.29/fs/ext3/super.c#L1546"&gt;ext3&lt;/a&gt;, where we can
&lt;a href="http://lxr.linux.no/linux+v2.6.29/fs/ext3/super.c#L1614"&gt;see that it uses&lt;/a&gt; a
&lt;a href="http://lxr.linux.no/linux+v2.6.29/include/linux/magic.h#L16"&gt;magic signature&lt;/a&gt;&lt;sup id="fnref:3"&gt;&lt;a class="footnote-ref" href="https://www.grulic.org.ar/~mdione/glob/posts/recovering-partitions-with-pen-and-paper/#fn:3"&gt;3&lt;/a&gt;&lt;/sup&gt;
&lt;a href="http://lxr.linux.no/linux+v2.6.29/include/linux/ext3_fs.h#L454"&gt;and&lt;/a&gt;
the &lt;a href="http://lxr.linux.no/linux+v2.6.29/include/linux/ext3_fs.h#L454"&gt;structure of the ext3
superblock&lt;/a&gt;,
where we can see &lt;a href="http://lxr.linux.no/linux+v2.6.29/include/linux/ext3_fs.h#L470"&gt;the magic's
offset&lt;/a&gt;
is 0x38.&lt;/p&gt;
&lt;p&gt;So the problem of finding an ext3 partition is reduced to the problem of finding
0x53ef (damn little endian) at a sector's offset 0x38 in the disk. Luckily
&lt;code&gt;more&lt;/code&gt; has a find tool, so I sit down to search &lt;em&gt;every&lt;/em&gt; occurrence of &lt;code&gt;53 ef&lt;/code&gt;,
hoping that the address at the left ends in &lt;code&gt;30&lt;/code&gt; and that they would be the
9th and 10th bytes in the line (damn 0 based offsets).&lt;/p&gt;
&lt;p&gt;A few 'next' after, I get my first candidate. It looks good, because I was also
comparing my findings with a similar dump from my USB key (which I have
formatted as &lt;code&gt;ext2&lt;/code&gt;, and luckily &lt;code&gt;ext2&lt;/code&gt; and &lt;code&gt;ext3&lt;/code&gt; share those structures), and
also I spot something that looks like a
&lt;a href="http://lxr.linux.no/linux+v2.6.29/include/linux/ext3_fs.h#L499"&gt;&lt;code&gt;uuid&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This candidate's address is &lt;code&gt;0x80731038&lt;/code&gt;. I substract &lt;code&gt;0x38&lt;/code&gt; and I get the
address &lt;code&gt;0x80731000&lt;/code&gt;, a nice round number for a superblock. Converted to decimal
that's &lt;code&gt;2.155.024.384&lt;/code&gt;, some 2GiB from the disk's begginning. Looks really good!
The swap partition could be before the root one, and could have that size.&lt;/p&gt;
&lt;p&gt;I use &lt;code&gt;fdisk /dev/sda&lt;/code&gt; to see the (still empty) partition table. It says there's
&lt;code&gt;16.065&lt;/code&gt; sectors per cylinder, times &lt;code&gt;512&lt;/code&gt; bytes per sector, equals &lt;code&gt;8.225.280&lt;/code&gt;
bytes per cylinder. Almost all distros (actually I think all of them) partition
disks at cylinder boundaries&lt;sup id="fnref:1"&gt;&lt;a class="footnote-ref" href="https://www.grulic.org.ar/~mdione/glob/posts/recovering-partitions-with-pen-and-paper/#fn:1"&gt;1&lt;/a&gt;&lt;/sup&gt;, so if the sector I found is right at the
beginning of a cylinder...&lt;/p&gt;
&lt;p&gt;I divide &lt;code&gt;2.155.024.384/8.225.280=...&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;(suspense pause)&lt;sup id="fnref:2"&gt;&lt;a class="footnote-ref" href="https://www.grulic.org.ar/~mdione/glob/posts/recovering-partitions-with-pen-and-paper/#fn:2"&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;262.000124494...&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;¡Damn! I almost had it... Hmm, how much is the factional part?
&lt;code&gt;(262.000124494-262)*8.225.280=...&lt;/code&gt; ¡&lt;code&gt;1024&lt;/code&gt;! ¿Is it that...?&lt;/p&gt;
&lt;p&gt;I run &lt;code&gt;strace debugfs -R show_super_stats /dev/sdb1&lt;/code&gt; (the partition
in my USB key) and I see that it actually seeks &lt;code&gt;1024&lt;/code&gt; bytes within the
partition for reading the superblock!&lt;/p&gt;
&lt;p&gt;This is it. With 262 in my head, I fire &lt;code&gt;fdisk /dev/sda&lt;/code&gt; and I create two
partitions: swap in cylinders 1-261 and root from cylinder 262 till the end. I
save, cross my fingers and I run &lt;code&gt;debugfs -R show_super_stats
/dev/sda1&lt;/code&gt;. It fails! What's wrong? I reboot and I try again, just in case the
kernel did not re-read correctly the partition table. It fails again. WTF?&lt;/p&gt;
&lt;p&gt;Ah, duh, it's &lt;code&gt;sda2&lt;/code&gt;, where do I have my head... Ok, &lt;code&gt;debugfs -R
show_super_stats /dev/sda2&lt;/code&gt;... it works, the sonofabitch works! I can't believe
it. I risk it: &lt;code&gt;fsck -n /dev/sda2&lt;/code&gt;. «Filesystem is clean». Damn, I try harder:
&lt;code&gt;fsck -n -f /dev/sda2&lt;/code&gt;...&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sda2 etc etc...
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;It's fine! But the MBR doesn't have GURB installed, so I do the usual GRUB
reinstall process, I reboot...&lt;/p&gt;
&lt;p&gt;It boots like nothing has happened, and it finishes in a beautiful login.
Satisifed, I pat myself in the back, pack my things and I start my weekend&lt;sup id="fnref:4"&gt;&lt;a class="footnote-ref" href="https://www.grulic.org.ar/~mdione/glob/posts/recovering-partitions-with-pen-and-paper/#fn:4"&gt;4&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;div class="footnote"&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;... wasting some 8MiB between the MBR and the first partition. &lt;a class="footnote-backref" href="https://www.grulic.org.ar/~mdione/glob/posts/recovering-partitions-with-pen-and-paper/#fnref:1" title="Jump back to footnote 1 in the text"&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:2"&gt;
&lt;p&gt;The sharp ones reading this will notice that this can not give an integer by
  no means. &lt;a class="footnote-backref" href="https://www.grulic.org.ar/~mdione/glob/posts/recovering-partitions-with-pen-and-paper/#fnref:2" title="Jump back to footnote 2 in the text"&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:3"&gt;
&lt;p&gt;Reiser magics are funny. Looks like he started the fad that now AdOlEsCeNtS
  use. &lt;a class="footnote-backref" href="https://www.grulic.org.ar/~mdione/glob/posts/recovering-partitions-with-pen-and-paper/#fnref:3" title="Jump back to footnote 3 in the text"&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:4"&gt;
&lt;p&gt;Update from 2023: yes, you got the math right. It took me a whole week of
  trial and error between other pressing tasks. &lt;a class="footnote-backref" href="https://www.grulic.org.ar/~mdione/glob/posts/recovering-partitions-with-pen-and-paper/#fnref:4" title="Jump back to footnote 4 in the text"&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description><category>disks</category><category>kernel</category><category>rescue</category><category>sysadmin</category><guid>https://www.grulic.org.ar/~mdione/glob/posts/recovering-partitions-with-pen-and-paper/</guid><pubDate>Thu, 07 Apr 2011 21:49:04 GMT</pubDate></item></channel></rss>