<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7921326074980135918</id><updated>2012-02-15T12:33:06.840+01:00</updated><title type='text'>Karel Zak's blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-9052037366056816776</id><published>2012-02-15T00:29:00.005+01:00</published><updated>2012-02-15T12:33:06.846+01:00</updated><title type='text'>libblkid maintainer's brain dump</title><content type='html'>This article is about the low-level probing libblkid code, and it's really dump, nothing more ;-)&lt;br /&gt;   &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;High and Low level&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The library contains two APIs.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;high-level&lt;/span&gt; - this is the original library code from e2fsprogs. All &lt;span style="font-style: italic; font-weight: bold;"&gt;results are cached&lt;/span&gt; in the file /etc/blkid.tab (or /run/blkid/blkid.tab). The advantage is that information about LABELs and UUIDs are accessible for non-root users and the cache has positive impact on performance.&lt;br /&gt;&lt;br /&gt;This advantage is no more valid on many systems where all necessary information are stored in udev db, and things like LABEL and UUID are accessible by /dev/disk/by-* udev symlinks.&lt;br /&gt;&lt;br /&gt;This is reason why for newly written programs are recommended blkid_evaluate_* functions which are able to use udev symlinks as well as the original libblkid cache. This functionality is also accessible from command line by the &lt;span style="font-family: courier new;"&gt;blkid -L|-U&lt;/span&gt; command.&lt;span style="font-weight: bold; font-family: courier new;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold; font-family: courier new;"&gt;low-level&lt;/span&gt;&lt;span style="font-family: courier new;"&gt; &lt;/span&gt;- this part of the API completely bypass the cache and allows to work directly with library probing functions. The rest of this article is about the low-level part of the library.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;The library contains three chains of the probing functions:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;superblocks&lt;/li&gt;&lt;li&gt;partitions&lt;/li&gt;&lt;li&gt;topology&lt;/li&gt;&lt;/ol&gt;The superblocks probing is enabled by default. The command &lt;span style="font-family:courier new;"&gt;"blkid -p -o udev"&lt;/span&gt; (or built-in code in udevd) enables partitions probing chain too.&lt;br /&gt;   &lt;br /&gt;There are two basic probing methods:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:courier new;"&gt;safeprobe&lt;/span&gt; - this is recommended method. This method cares about collisions between filesystems, raids or partition tables.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:courier new;"&gt;fullprobe&lt;/span&gt; - don't check for conflicts, used for example in &lt;span style="font-family:courier new;"&gt;wipefs(8)&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;For the superblock is available NAME=value based API only. For topology and partitions is available binary interface too. See the docs link below.&lt;br /&gt;   &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Superblocks&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;three basic "usage" groups: filesystems, raids, crypto and others&lt;/li&gt;&lt;li&gt;RAIDs (MD, LVM, ...) are probed before filesystems&lt;/li&gt;&lt;li&gt;don't check for filesystems when a RAID signature is detected &lt;br /&gt;&lt;/li&gt;&lt;li&gt;don't check for RAIDs or others (swap-area) on CD-ROMs     &lt;br /&gt;&lt;/li&gt;&lt;li&gt;don't check for RAIDs on tiny devices (&amp;lt; 1 MiB)     &lt;br /&gt;&lt;/li&gt;&lt;li&gt;don't read whole FAT root directory (to lookup LABEL) on tiny devices (&amp;lt; 1 MiB)&lt;/li&gt;&lt;/ul&gt;     exceptions / extra cases:&lt;ul&gt;&lt;li&gt;MD RAID is ignored if detected within a valid partition during whole-disk probing&lt;br /&gt;&lt;br /&gt;[use case: partitioned disk, last partition used as a RAID member and the RAID has metadata at the end of the last partition (so end of the disk)]&lt;br /&gt;   &lt;br /&gt;&lt;/li&gt;&lt;li&gt;LVM signature is ignored if another signature is detected within first 8KiB of the device (LVM wipes this area, so there should not be any filesystem superblock)&lt;br /&gt;&lt;br /&gt;[use case: disk with LVM, user stops to use LVM and creates a new partition table by fdisk, result is MBR and obsolete LVM signature on the same device]&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Partitions&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;disabled by default, enabled for udev (see ID_PART_ENTRY_* in udev db)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;parse partition tables (aix, minix, bsd, mbr, gpt, mac, sgi, solaris, sun, ultrix and unixware)&lt;/li&gt;&lt;li&gt;detect nested partition tables (e.g. BSD) within partitions&lt;br /&gt;&lt;/li&gt;&lt;li&gt;if given device is a partition (e.g. sda1) then open whole disk (e.g. sda) to read details about the partition from partition table. This feature has to be enabled by BLKID_PARTS_ENTRY_DETAILS flag.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;partition table is ignored if a valid RAID superblock is detected at the end of the device&lt;br /&gt;&lt;br /&gt;[use case: partitioned RAID1 (mirror) -- the partition table is visible from underlaying devices]&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Topology&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt; rarely used&lt;/li&gt;&lt;li&gt;designed for mkfs-like or fdisk-like programs to get info about I/O topology&lt;/li&gt;&lt;li&gt;for kernel &amp;gt;= 2.6.3x uses ioctl or sysfs&lt;/li&gt;&lt;li&gt;as fallback for old kernels uses code originally from xfsprogs&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;Tips for users&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;please use &lt;span style="font-family:courier new;"&gt;wipefs(8)&lt;/span&gt; before fdisk, mkfs or mkswap. The latest version is able to remove really all possible backup signatures, partition tables and at first glance invisible things. &lt;span style="font-weight: bold;"&gt;Don't rely on mkfs developers :-)&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;think twice before you start to use some complex setups (for example partitioned RAIDs) to avoid misinterpretation by kernel or system tools.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;don't forget that blkid without -p might returns cached results&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Tips for developers&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;use &lt;span style="font-family:courier new;"&gt;blkid_evaluate_*&lt;/span&gt; functions to convert LABEL or UUID to device name (it's portable and able to use udev /dev/disk/by-* symlinks)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;libblkid uses symbols versioning and soname will NOT change, API is stable.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;API docs: &lt;a href="http://ftp.kernel.org/pub/linux/utils/util-linux/v2.21/libblkid-docs/index.html"&gt;http://ftp.kernel.org/pub/linux/utils/util-linux/v2.21/libblkid-docs/index.html&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;.... I'll try to keep these notes updated.&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-9052037366056816776?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/9052037366056816776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2012/02/libblkid-maintainers-brain-dump.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/9052037366056816776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/9052037366056816776'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2012/02/libblkid-maintainers-brain-dump.html' title='libblkid maintainer&apos;s brain dump'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-1180376758531309034</id><published>2012-02-10T16:00:00.000+01:00</published><updated>2012-02-10T16:12:11.045+01:00</updated><title type='text'>login(1) changes</title><content type='html'>I have completely refactored &lt;span style="font-family: courier new;"&gt;login(1)&lt;/span&gt;. The new&lt;span style="font-family: courier new;"&gt; login(1)&lt;/span&gt; merges features from Suse &lt;span style="font-family: courier new;"&gt;login(1)&lt;/span&gt; back into util-linux version and is more compatible with &lt;span style="font-family: courier new;"&gt;login(1) &lt;/span&gt;from shadow-utils. I believe that now we have &lt;span style="font-family: courier new;"&gt;login(1)&lt;/span&gt; implementation which is usable in all mainstream Linux distributions.&lt;br /&gt;&lt;br /&gt;The original util-linux &lt;span style="font-family: courier new;"&gt;login(1)&lt;/span&gt; code is derived from 4.3 BSD (so older than Linux kernel).&lt;br /&gt;&lt;br /&gt;Changes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;  PAM only&lt;br /&gt;&lt;br /&gt;It's obvious that in all mainstream distributions is PAM de facto standard for  users authentication and maintain any non-PAM methods in login(1) is waste of time.&lt;br /&gt;&lt;br /&gt;If you don't like this change (really?) than you can use &lt;span style="font-family: courier new;"&gt;login(1)&lt;/span&gt; from  shadow-utils.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;support &lt;span style="font-family: courier new;"&gt;/etc/login.defs(5)&lt;/span&gt; config file&lt;br /&gt;&lt;br /&gt;Supported options: MOTD_FILE, LOGIN_TIMEOUT, LOGIN_RETRIES, FAIL_DELAY,  TTYPERM, TTYGROUP HUSHLOGIN_FILE, DEFAULT_HOME, LOG_UNKFAIL_ENAB, ENV_PATH,  ENV_ROOTPATH, ENV_SUPATH&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;print hostname in the login prompt, the default prompt is compatible with   initial prompt from agetty&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;add -H for compatibility with Suse version. This option suppresses the hostname printing in the login prompt.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;global hush mode for all accounts (enabled if &lt;span style="font-family: courier new;"&gt;/etc/hushlogins&lt;/span&gt; exists, but is empty). The global hush mode allows to use PAM for "Last login" message.&lt;/li&gt;&lt;/ul&gt;More details: &lt;a href="http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/4866"&gt;http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/4866&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-1180376758531309034?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/1180376758531309034/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2012/02/login1-changes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/1180376758531309034'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/1180376758531309034'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2012/02/login1-changes.html' title='login(1) changes'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-5779042213942075539</id><published>2012-01-25T22:20:00.002+01:00</published><updated>2012-01-25T22:48:04.171+01:00</updated><title type='text'>prlimit(1)</title><content type='html'>&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:courier new;"&gt;prlimit(1&lt;/span&gt;)&lt;/span&gt; is a new util that will be available in util-linux-2.21 (now -rc1). This new util is very nice and flexible command line interface to prlimit(2) Linux syscall (supported since Linux 2.6.36).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;prlimit(1)&lt;/span&gt; allows to get or set one or more process resource limits for given PID. When a command is given instead of PID, &lt;span style="font-family:courier new;"&gt;prlimit(1)&lt;/span&gt; will run this command with the given resources.&lt;br /&gt;&lt;br /&gt;The output is flexible like output from&lt;span style="font-family:courier new;"&gt; lsblk(8)&lt;/span&gt; or &lt;span style="font-family:courier new;"&gt;findmnt(8)&lt;/span&gt;. You can define the output columns, use parsable output etc.&lt;br /&gt;&lt;br /&gt;See the default output:&lt;pre&gt;  $ prlimit --pid $$&lt;br /&gt;  RESOURCE   DESCRIPTION                             SOFT      HARD UNITS&lt;br /&gt;  AS         address space limit                unlimited unlimited bytes&lt;br /&gt;  CORE       max core file size                         0 unlimited blocks&lt;br /&gt;  CPU        CPU time                           unlimited unlimited seconds&lt;br /&gt;  DATA       max data size                      unlimited unlimited bytes&lt;br /&gt;  FSIZE      max file size                      unlimited unlimited blocks&lt;br /&gt;  LOCKS      max number of file locks held      unlimited unlimited&lt;br /&gt;  MEMLOCK    max locked-in-memory address space     65536     65536 bytes&lt;br /&gt;  MSGQUEUE   max bytes in POSIX mqueues            819200    819200 bytes&lt;br /&gt;  NICE       max nice prio allowed to raise             0         0&lt;br /&gt;  NOFILE     max number of open files                1024      4096&lt;br /&gt;  NPROC      max number of processes                 1024     62809&lt;br /&gt;  RSS        max resident set size              unlimited unlimited pages&lt;br /&gt;  RTPRIO     max real-time priority                     0         0&lt;br /&gt;  RTTIME     timeout for real-time tasks        unlimited unlimited microsecs&lt;br /&gt;  SIGPENDING max number of pending signals          62809     62809&lt;br /&gt;  STACK      max stack size                       8388608 unlimited bytes&lt;br /&gt;&lt;/pre&gt;or redefine the output and ask for max number of open files only:&lt;br /&gt;&lt;pre&gt;  $ prlimit  --nofile --output RESOURCE,SOFT,HARD --pid $$&lt;br /&gt;  RESOURCE SOFT HARD&lt;br /&gt;  NOFILE   1024 4096&lt;br /&gt;&lt;/pre&gt;and now let's modify the soft limit of maximal core file size and maximal number of open files:&lt;br /&gt;&lt;pre&gt;  $ prlimit --core=1000000: --nofile=100: --pid $$&lt;br /&gt;&lt;/pre&gt;the notation used for the limits is:&lt;br /&gt;&lt;pre&gt;  soft:hard    specify both limits&lt;br /&gt;  soft:        specify only the soft limit&lt;br /&gt;  :hard        specify only the hard limit&lt;br /&gt;  value        specify both soft and hard limits to the same value&lt;/pre&gt;and check the result:&lt;pre&gt;  $ prlimit  --nofile --core --pid $$&lt;br /&gt;  RESOURCE DESCRIPTION                 SOFT      HARD UNITS&lt;br /&gt;  NOFILE   max number of open files     100      1024&lt;br /&gt;  CORE     max core file size       1000000 unlimited blocks&lt;br /&gt;&lt;/pre&gt;and revert the core file soft limit:&lt;pre&gt;  $ prlimit --core=unlimited: --pid $$&lt;br /&gt;&lt;br /&gt;  $ prlimit --core --pid $$&lt;br /&gt;  RESOURCE DESCRIPTION             SOFT      HARD UNITS&lt;br /&gt;  CORE     max core file size unlimited unlimited blocks&lt;br /&gt;&lt;/pre&gt;Do you want to restrict CPU time for given command (sort(1) in this example):&lt;pre&gt;   $ prlimit --cpu=10 sort -u hugefile&lt;br /&gt;&lt;/pre&gt;I think &lt;span style="font-family: courier new;"&gt;prlimit(1)&lt;/span&gt; is much better than the shell built-in command &lt;span style="font-family: courier new;"&gt;ulimit&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: right;"&gt;&lt;div style="text-align: left;"&gt;Thanks to Davidlohr Bueso who found time to implement &lt;span style="font-family: courier new;"&gt;prlimit(1)&lt;/span&gt; for util-linux 2.21.&lt;br /&gt;&lt;/div&gt;-- &lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;In memory of Dennis M. Ritchie&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-5779042213942075539?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/5779042213942075539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2012/01/prlimit1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/5779042213942075539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/5779042213942075539'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2012/01/prlimit1.html' title='prlimit(1)'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-2279913005363343393</id><published>2012-01-09T14:19:00.003+01:00</published><updated>2012-01-09T15:03:18.881+01:00</updated><title type='text'>frustrating gnome-control-center network</title><content type='html'>The "gnome-control-center network" is pretty incomplete application. Unfortunately, this application is called by gnome-shell if you want to modify your network settings. And all this is default in Fedora-16. Grrrr...&lt;br /&gt;&lt;br /&gt;The most stupid thing is that you cannot configure wireless connections if your wireless is disabled. And if you enable wireless then you will be affected by your broken configuration...&lt;br /&gt;&lt;br /&gt;Fortunately, old good nm-connection-editor works as expected. So, all you need is to kick off the idiotic network stuff from gnome-shell and start old good Network Manager Applet:&lt;pre&gt; mv /usr/share/gnome-shell/js/ui/status/network.js \&lt;br /&gt;       /usr/share/gnome-shell/js/ui/status/network.disabled&lt;/pre&gt;&lt;br /&gt;and restart gnome-shell (command 'r').&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-2279913005363343393?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/2279913005363343393/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2012/01/frustrating-gnome-control-center.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/2279913005363343393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/2279913005363343393'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2012/01/frustrating-gnome-control-center.html' title='frustrating gnome-control-center network'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-5343746383897912366</id><published>2012-01-05T15:52:00.001+01:00</published><updated>2012-01-05T16:14:11.110+01:00</updated><title type='text'>gnome-shell is not so bad</title><content type='html'>It seems that I will be able to use GNOME 3. I love the minimalism provided by gnome-shell. It's gnome, so it's tricky to fully customize the desktop, but it's possible.&lt;br /&gt;&lt;br /&gt;My requirements:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;no animations (gnome "switch workspace" is pure hell...)&lt;/li&gt;&lt;li&gt;tagging -- at least for terminal (fluxbox supports this for arbitrary application, gnome has at least gnome-terminal with tabs)&lt;/li&gt;&lt;li&gt;minimalistic windows decoration&lt;/li&gt;&lt;li&gt;no window title for maximized windows&lt;/li&gt;&lt;li&gt;tiny window title for normal and modal windows&lt;/li&gt;&lt;li&gt;no max/min/close buttons for windows (I have keyboard...)&lt;/li&gt;&lt;li&gt;pretty visible focused window (e.g. green border)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;only one tiny panel&lt;/li&gt;&lt;li&gt;WM has to remember workspace for applications (e.g. firefox = 2nd workspace)&lt;/li&gt;&lt;/ul&gt;We all love screenshots, right? ;-) My old good fluxbox &lt;a href="http://people.redhat.com/kzak/fluxbox/"&gt;here&lt;/a&gt;, and the "same" with GNOME 3 is &lt;a href="http://people.redhat.com/kzak/gnome3/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The first step is to install some gnome-shell extensions:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Native Window Placement Extension&lt;/li&gt;&lt;li&gt;Auto move windows extension&lt;/li&gt;&lt;li&gt;Disable Window Animation Extension&lt;/li&gt;&lt;li&gt;Remove User Name Extension&lt;/li&gt;&lt;li&gt;windowNavigator Extension&lt;/li&gt;&lt;/ul&gt;The next steps is to make windows decorations more minimalistic. This step is more tricky, because you have to modify window manager theme (for more details see gnome &lt;a href="https://bugzilla.gnome.org/show_bug.cgi?id=594879"&gt;bug 594879&lt;/a&gt;). My theme is available at my &lt;a href="http://people.redhat.com/kzak/gnome3/"&gt;home page&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The next step is to customize desktop files for some applications, for example I want to start gnome-terminal with --hide-menubar option, so &lt;pre&gt;cp /usr/share/applications/gnome-terminal.desktop \&lt;br /&gt;   ~/.local/share/applications/myterm.desktop&lt;/pre&gt;and modify Exec and Name entries in the file. Then you can add the application to your gnome-shell Favorites.&lt;br /&gt;&lt;br /&gt;The last step is to customize keyboard shortcuts, this is simple (see "keyboard" in gnome-control center).&lt;br /&gt;&lt;br /&gt;Note than many things like info about CPU temperature does not have to waste any place on your desktop. IMHO it's better to use keyboard shortcuts and print necessary information to the screen on demand. For example I use osd_cat:&lt;br /&gt;&lt;pre&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;BATT=$(acpitool -b | awk -F ':' '/Battery/ { print $2 }' | sed 's/ //')&lt;br /&gt;AC=$(acpitool -a | awk -F ':' '/AC/ { print $2 }' | sed 's/ //g')&lt;br /&gt;TEMPE=$(sensors | awk '/temp/ { print $2 }' | sed 's/ //g')&lt;br /&gt;FAN=$(sensors | awk '/fan/ { print $2 }'  | sed 's/ //g')&lt;br /&gt;&lt;br /&gt;(printf "    Battery: %-20s\n" "$BATT"&lt;br /&gt;printf "         AC: %-20s\n" "$AC"&lt;br /&gt;printf "Temperature: %-20s \n" "$TEMPE"&lt;br /&gt;printf "        Fan: %-20s\n" "$FAN") | osd_cat --delay 4 --pos bottom      \&lt;br /&gt;                                                          --align right --offset 45 --indent 10 \&lt;br /&gt;                                                          --color green --font "-misc-fixed-*-*-*-*-20-*-*-*-*-*-*-*"&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-5343746383897912366?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/5343746383897912366/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2012/01/gnome-shell-is-not-so-bad.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/5343746383897912366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/5343746383897912366'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2012/01/gnome-shell-is-not-so-bad.html' title='gnome-shell is not so bad'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-4949428078295785991</id><published>2011-12-05T12:39:00.008+01:00</published><updated>2011-12-05T13:12:02.324+01:00</updated><title type='text'>Monitor a list of currently mounted filesystems</title><content type='html'>You know that /proc/mounts and /proc/self/mountinfo contain list of currently mounted filesystems. These files is possible to monitor by poll(2) or select(2) functions. The util findmnt(8) exports this functionality to command line.&lt;br /&gt;&lt;br /&gt;Examples:                                                     &lt;br /&gt;&lt;pre&gt;session A (monitor):                                          &lt;br /&gt;   findmnt --poll&lt;br /&gt;session B (event):&lt;br /&gt;   mount /home/fs-images/ext2.img /mnt/test&lt;br /&gt;                                                 &lt;br /&gt;session A (findmnt output after event):       &lt;br /&gt;   ACTION     TARGET    SOURCE     FSTYPE OPTIONS&lt;br /&gt;   mount      /mnt/test /dev/loop0 ext2   rw,relatime,user_xattr,acl,barrier=1&lt;br /&gt;&lt;/pre&gt;The another examples; wait until /mnt/test is unmounted:&lt;br /&gt;&lt;pre&gt;   findmnt --poll=umount --first-only /mnt/test&lt;br /&gt;&lt;/pre&gt;                   Inform me about all ext2, ext3, and ext4 remounts to read-only mode:&lt;br /&gt;&lt;pre&gt;   findmnt --poll=remount --types ext2,ext3,ext4 --options ro&lt;br /&gt;&lt;/pre&gt;                                                  You can also define output columns, for example if you want to know more about "mount --move" operations:                                                     &lt;br /&gt;&lt;pre&gt;   # findmnt --poll=move -o OLD-TARGET,TARGET,SOURCE&lt;br /&gt;   OLD-TARGET TARGET   SOURCE                      &lt;br /&gt;   /mnt/test  /mnt/foo /dev/loop0                  &lt;br /&gt;&lt;/pre&gt;                                                         the event in this example was generated by "mount --move /mnt/test /mnt/foo" command.&lt;br /&gt;                                                 &lt;br /&gt;And for example if you want info about old and new options after remount:                                                     &lt;br /&gt;&lt;pre&gt;   # findmnt --poll=remount -o TARGET,OLD-OPTIONS,OPTIONS&lt;br /&gt;   TARGET   OLD-OPTIONS                          OPTIONS&lt;br /&gt;   /mnt/foo ro,relatime,user_xattr,acl,barrier=1 rw,user_xattr,acl,barrier=1&lt;br /&gt;&lt;/pre&gt;                                                         this event was generated by "mount -o remount /mnt/foo -o rw,strictatime" command.&lt;br /&gt;&lt;br /&gt;All this is available in util-linux 2.20 (e.g. Fedora 16).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-4949428078295785991?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/4949428078295785991/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2011/12/monitor-list-of-currently-mounted.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/4949428078295785991'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/4949428078295785991'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2011/12/monitor-list-of-currently-mounted.html' title='Monitor a list of currently mounted filesystems'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-3944557964335094565</id><published>2011-11-25T11:48:00.004+01:00</published><updated>2011-11-25T12:07:03.635+01:00</updated><title type='text'>wipefs(8) improvements</title><content type='html'>I finally found time to improve the command wipefs(8). The most visible change is support for partition tables. You can use wipefs(8) to remove MBR as well as GPT and many others partition tables.&lt;br /&gt;&lt;br /&gt;The another important change (well.. bugfix) is that "wipefs -a" really erases everything what is possible to detect by libblkid (blkid(8)).&lt;br /&gt;&lt;br /&gt;Now it calls libblkid detection code also after magic string erasing to ensure that nothing is possible to found on the device. This is important for stuff like GPT where is backup table on another place or for filesystems like FAT where is more ways to detect the superblock.&lt;br /&gt;&lt;br /&gt;The last important change is a new command line option "-t". Now you can specify filesystem, raid or partition table name. For example&lt;pre&gt;       wipefs -a -t ext4&lt;br /&gt;&lt;/pre&gt;will erase 'ext4' only. The option is interpreted in the same way how -t for mount(8) or findmnt(8), so you can specify more filesystems and you can prefix all or selected filesystems by 'no' prefix, for example:&lt;pre&gt;       wipefs -a -t noext4,ext3,ext2&lt;br /&gt;&lt;/pre&gt;all but ext4, ext3 and ext2 filesystems will be erased.&lt;br /&gt;&lt;br /&gt;If you're filesystem tools (e.g. mkfs.type) developer then you should know that now libblkid contains a new function blkid_do_wipe():&lt;pre&gt;      &lt;br /&gt;    blkid_probe pr = blkid_new_probe_from_filename("/dev/sda1");&lt;br /&gt;&lt;br /&gt;    blkid_probe_enable_superblock(pr, true);&lt;br /&gt;    blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_MAGIC);&lt;br /&gt;&lt;br /&gt;    while (blkid_do_probe(pr) == 0)&lt;br /&gt;            blkid_do_wipe(pr, 0);&lt;br /&gt;&lt;br /&gt;    blkid_free_probe(pr);&lt;br /&gt;&lt;/pre&gt;and all superblocks are undetectable...&lt;br /&gt;&lt;br /&gt;By the way, it's also good idea to call wipefs -a from system installer to avoid some unexpected problems. I have seen many bug reports from people with mess on their disks (unexpected mix of partition table and raid superblocks, swap and LUKS or ReiserFS ...etc.).&lt;br /&gt;&lt;br /&gt;The changes will be available in the next util-linux release 2.21 (beta planned next month).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-3944557964335094565?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/3944557964335094565/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2011/11/wipefs8-improvements.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/3944557964335094565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/3944557964335094565'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2011/11/wipefs8-improvements.html' title='wipefs(8) improvements'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-870599541573622965</id><published>2011-11-07T23:05:00.005+01:00</published><updated>2011-11-07T23:29:18.994+01:00</updated><title type='text'>util-linux stats</title><content type='html'>Today Sami Kerola (util-linux contributor) sent me nice &lt;a href="http://www.r-project.org"&gt;R&lt;/a&gt; graphs from git commit logs. &lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-Ym4JisfEYtk/TrhX7Hvdk6I/AAAAAAAAAC8/fzSCseVBOhA/s1600/commit-history.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 375px;" src="http://4.bp.blogspot.com/-Ym4JisfEYtk/TrhX7Hvdk6I/AAAAAAAAAC8/fzSCseVBOhA/s400/commit-history.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5672380403875156898" /&gt;&lt;/a&gt;&lt;br /&gt;... yes, the project is growing&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/-4cB2BsZw9EM/TrhZAXqq_CI/AAAAAAAAADI/f8z023jcREI/s1600/commit-hour-weekday.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 209px;" src="http://2.bp.blogspot.com/-4cB2BsZw9EM/TrhZAXqq_CI/AAAAAAAAADI/f8z023jcREI/s400/commit-hour-weekday.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5672381593561005090" /&gt;&lt;/a&gt;&lt;br /&gt;...but weekend is weekend&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-hmxf_12L-7E/TrhZsP6ImtI/AAAAAAAAADU/S-l4g5a0cVg/s1600/commit-months.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 375px;" src="http://3.bp.blogspot.com/-hmxf_12L-7E/TrhZsP6ImtI/AAAAAAAAADU/S-l4g5a0cVg/s400/commit-months.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5672382347392621266" /&gt;&lt;/a&gt;&lt;br /&gt;... oh, I thought that we all love summer!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-870599541573622965?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/870599541573622965/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2011/11/util-linux-stats.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/870599541573622965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/870599541573622965'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2011/11/util-linux-stats.html' title='util-linux stats'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-Ym4JisfEYtk/TrhX7Hvdk6I/AAAAAAAAAC8/fzSCseVBOhA/s72-c/commit-history.png' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-5967631708221782851</id><published>2011-07-20T17:08:00.004+02:00</published><updated>2011-07-20T17:27:14.513+02:00</updated><title type='text'>dmesg(1) changes for util-linux 2.20</title><content type='html'>I have re-written the dmesg(1). That's the first large change in the code in last 18 years.&lt;br /&gt;&lt;br /&gt;New features:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; &lt;span style="font-family:times new roman;"&gt;--decode&lt;/span&gt; facility and level number to human readable prefixes&lt;/li&gt;&lt;/ul&gt;&lt;pre&gt;$ dmesg --decode&lt;br /&gt;kern  :info  : [26443.677632] ata1.00: configured for UDMA/100&lt;br /&gt;kern  :info  : [26443.830225] PM: resume of devices complete after 2452.856 msecs&lt;br /&gt;kern  :debug : [26443.830606] PM: Finishing wakeup.&lt;br /&gt;kern  :warn  : [26443.830608] Restarting tasks ... done.&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;filter out messages according to the &lt;span style="font-family:times new roman;"&gt;--facility&lt;/span&gt; and &lt;span style="font-family:times new roman;"&gt;--level&lt;/span&gt; options, for example&lt;/li&gt;&lt;/ul&gt;&lt;pre&gt;$ dmesg --level=err,warn&lt;br /&gt;&lt;br /&gt;$ dmesg --facility=daemon,user&lt;br /&gt;&lt;br /&gt;$ dmesg --facility=daemon --level=debug&lt;/pre&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:times new roman;"&gt; -u, --userspace&lt;/span&gt; to print only userspace messages&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:times new roman;"&gt; -k, --kernel &lt;/span&gt;to print only kernel messages&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:times new roman;"&gt;-t, --notime&lt;/span&gt; to skip [...] timestamps&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:times new roman;"&gt;-T, --ctime&lt;/span&gt; to print human readable timestamp in ctime()-like format. Unfortunately, this is useless on laptops if you have used suspend/resume. (The kernel does not use the standard system time as a source for printk() and it's not updated after resume.)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:times new roman;"&gt;--show-delta&lt;/span&gt; to print time delta between printed messages&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;pre&gt;$ dmesg --show-delta&lt;br /&gt;[35523.876281 &amp;lt;    4.016887&amp;gt;] usb 1-4.1: new low speed USB device using  hci_hcd and address 12&lt;br /&gt;[35523.968398 &amp;lt;    0.092117&amp;gt;] usb 1-4.1: New USB device found, idVendor=413c, idProduct=2003&lt;br /&gt;[35523.968408 &amp;lt;    0.000010&amp;gt;] usb 1-4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0&lt;br /&gt;[35523.968416 &amp;lt;    0.000008&amp;gt;] usb 1-4.1: Product: Dell USB Keyboard&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-5967631708221782851?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/5967631708221782851/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2011/07/dmesg1-changes-for-util-linux-220.html#comment-form' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/5967631708221782851'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/5967631708221782851'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2011/07/dmesg1-changes-for-util-linux-220.html' title='dmesg(1) changes for util-linux 2.20'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-4005375023857171109</id><published>2011-04-20T16:51:00.002+02:00</published><updated>2011-04-20T17:11:37.953+02:00</updated><title type='text'>bind mounts, mtab and read-only</title><content type='html'>The bind mount feature is supported since Linux 2.4. It's pretty long time, but many users still think that bind mounts are something completely different to the normal mounts.&lt;br /&gt;&lt;br /&gt;Example 1:&lt;br /&gt;&lt;pre&gt; # mount /dev/sdb1 /mnt/A&lt;br /&gt; # mount /dev/sdb1 /mnt/B&lt;br /&gt;&lt;/pre&gt;This is not a bug. It's possible to mount the same filesystem on two places.&lt;br /&gt;&lt;br /&gt;Example 2:&lt;br /&gt;&lt;pre&gt; # mount /dev/sdb1 /mnt/A&lt;br /&gt; # mount --bind /mnt/A /mnt/B&lt;br /&gt;&lt;/pre&gt;The result from both examples is the same, see /proc/self/mountinfo:&lt;br /&gt;&lt;pre&gt; # grep mnt /proc/self/mountinfo&lt;br /&gt; 48 20 8:17 / /mnt/A rw,relatime - ext4 /dev/sdb1 rw,barrier=1,stripe=64,data=ordered&lt;br /&gt; 49 20 8:17 / /mnt/B rw,relatime - ext4 /dev/sdb1 rw,barrier=1,stripe=64,data=ordered&lt;br /&gt;&lt;/pre&gt;This is very important, from kernel point of view is it the same thing. The same filesystem is mounted on two places.&lt;br /&gt;&lt;br /&gt;The kernel &lt;span style="font-style: italic;"&gt;does not maintain&lt;/span&gt; anywhere information that &lt;span style="font-family:courier new;"&gt;/mnt/B&lt;/span&gt; was created by bind mount (MS_BIND mount(2) syscall flags). There is not dependence between&lt;span style="font-family:courier new;"&gt; /mnt/A&lt;/span&gt; and&lt;span style="font-family:courier new;"&gt; /mnt/B&lt;/span&gt; (for example you can umount &lt;span style="font-family:courier new;"&gt;/mnt/A&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;Unfortunately, the situation in the &lt;span style="font-family:courier new;"&gt;/etc/mtab&lt;/span&gt; file is completely different:&lt;br /&gt;&lt;pre&gt; # grep mnt /etc/mtab&lt;br /&gt; /dev/sdb1 /mnt/A ext4 rw 0 0&lt;br /&gt; /mnt/A    /mnt/B none rw,bind 0 0&lt;br /&gt;&lt;/pre&gt;This is confusing for many users. Try:&lt;br /&gt;&lt;pre&gt; # umount /mnt/A&lt;br /&gt; # rm -rf /mnt/A&lt;br /&gt;&lt;br /&gt; # grep mnt /etc/mtab&lt;br /&gt; /mnt/A /mnt/B none rw,bind 0 0&lt;br /&gt;&lt;/pre&gt;Does the information in mtab make any sense? I don't think so... Keep this kind of information in userspace is mistake. Yeah, mtab is evil.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Everyone who uses bind mounts on system without mtab (where mtab is symlink to&lt;span style="font-family:courier new;"&gt; /proc/mounts&lt;/span&gt;) has to undestand that "bind" flag is no more stored anywhere. For example you have to explicitly add the flag to the mount options if you want to use read-only bind mount.&lt;br /&gt;&lt;pre&gt; # rm -f /etc/mtab&lt;br /&gt; # ln -s /proc/mounts /etc/mtab&lt;br /&gt;&lt;/pre&gt;(or install Fedora 15:-)&lt;br /&gt;&lt;br /&gt;Let's use &lt;span style="font-family:courier new;"&gt;findmnt(8)&lt;/span&gt; rather than &lt;span style="font-family:courier new;"&gt;grep /proc/self/mountinfo&lt;/span&gt;:&lt;br /&gt;&lt;pre&gt; # findmnt -o TARGET,VFS-OPTIONS,FS-OPTIONS /dev/sda1&lt;br /&gt; TARGET VFS-OPTIONS FS-OPTIONS&lt;br /&gt; /mnt/A rw,relatime rw,errors=continue,user_xattr,acl,barrier=0,data=ordered&lt;br /&gt; /mnt/B rw,relatime rw,errors=continue,user_xattr,acl,barrier=0,data=ordered&lt;br /&gt;&lt;/pre&gt;What will happen if we try to remount with bind flag? See:&lt;br /&gt;&lt;pre&gt;  # mount -o remount,ro,&lt;span style="color: rgb(153, 0, 0);"&gt;bind&lt;/span&gt; /mnt/B&lt;br /&gt;&lt;br /&gt; # findmnt -o TARGET,VFS-OPTIONS,FS-OPTIONS /dev/sda1&lt;br /&gt; TARGET &lt;span style="color: rgb(153, 0, 0);"&gt;VFS-OPTIONS&lt;/span&gt; FS-OPTIONS&lt;br /&gt; /mnt/A rw,relatime rw,errors=continue,user_xattr,acl,barrier=0,data=ordered&lt;br /&gt; /mnt/B &lt;span style="color: rgb(153, 0, 0);"&gt;ro&lt;/span&gt;,relatime rw,errors=continue,user_xattr,acl,barrier=0,data=ordered&lt;br /&gt;&lt;/pre&gt;The filesystem (superblock) is still read-write, but the &lt;span style="font-family:courier new;"&gt;/mnt/B&lt;/span&gt; mountpoint is in VFS marked as read-only.&lt;br /&gt;&lt;br /&gt;And now the same thing without the bind flag:&lt;br /&gt;&lt;pre&gt; # mount -o remount,ro /mnt/B&lt;br /&gt;&lt;br /&gt; # findmnt -o TARGET,VFS-OPTIONS,&lt;span style="color: rgb(153, 0, 0);"&gt;FS-OPTIONS&lt;/span&gt; /dev/sda1&lt;br /&gt; TARGET VFS-OPTIONS FS-OPTIONS&lt;br /&gt; /mnt/A rw,relatime &lt;span style="color: rgb(153, 0, 0);"&gt;ro&lt;/span&gt;,errors=continue,user_xattr,acl,barrier=0,data=ordered&lt;br /&gt; /mnt/B ro,relatime &lt;span style="color: rgb(153, 0, 0);"&gt;ro&lt;/span&gt;,errors=continue,user_xattr,acl,barrier=0,data=ordered&lt;br /&gt;&lt;/pre&gt;the superblock has been remounted read-only, so the filesystem is read-only everywhere in the system.&lt;br /&gt;&lt;br /&gt;Again, all this is possible independently on the way how &lt;span style="font-family:courier new;"&gt;/mnt/B&lt;/span&gt; has been mounted to the system (examples 1 and 2).&lt;br /&gt;&lt;br /&gt;BTW, you can also set the block device as read-only  by &lt;span style="font-family:courier new;"&gt;blockdev --setro&lt;/span&gt;. So we have three layers (device -&amp;gt; FS -&amp;gt; VFS) where is possible to set read-only attribute :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-4005375023857171109?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/4005375023857171109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2011/04/bind-mounts-mtab-and-read-only.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/4005375023857171109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/4005375023857171109'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2011/04/bind-mounts-mtab-and-read-only.html' title='bind mounts, mtab and read-only'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-6194445067770050705</id><published>2011-01-04T14:08:00.002+01:00</published><updated>2011-01-04T14:34:10.737+01:00</updated><title type='text'>findmnt(8) and submounts</title><content type='html'>I just applied (to the util-linux upstream) a patch that allows to list all submounts for defined filesystem(s). For example:&lt;br /&gt;&lt;pre&gt;$ findmnt --submounts /sys&lt;br /&gt;TARGET                     SOURCE    FSTYPE  OPTIONS&lt;br /&gt;/sys                       /sys      sysfs   rw,relatime&lt;br /&gt;├─/sys/fs/cgroup           tmpfs     tmpfs   rw,nosuid,nodev,noexec,relat&lt;br /&gt;│ ├─/sys/fs/cgroup/systemd cgroup    cgroup  rw,nosuid,nodev,noexec,relat&lt;br /&gt;│ ├─/sys/fs/cgroup/cpuset  cgroup    cgroup  rw,nosuid,nodev,noexec,relat&lt;br /&gt;│ ├─/sys/fs/cgroup/ns      cgroup    cgroup  rw,nosuid,nodev,noexec,relat&lt;br /&gt;│ ├─/sys/fs/cgroup/cpu     cgroup    cgroup  rw,nosuid,nodev,noexec,relat&lt;br /&gt;│ ├─/sys/fs/cgroup/cpuacct cgroup    cgroup  rw,nosuid,nodev,noexec,relat&lt;br /&gt;│ ├─/sys/fs/cgroup/memory  cgroup    cgroup  rw,nosuid,nodev,noexec,relat&lt;br /&gt;│ ├─/sys/fs/cgroup/devices cgroup    cgroup  rw,nosuid,nodev,noexec,relat&lt;br /&gt;│ ├─/sys/fs/cgroup/freezer cgroup    cgroup  rw,nosuid,nodev,noexec,relat&lt;br /&gt;│ ├─/sys/fs/cgroup/net_cls cgroup    cgroup  rw,nosuid,nodev,noexec,relat&lt;br /&gt;│ └─/sys/fs/cgroup/blkio   cgroup    cgroup  rw,nosuid,nodev,noexec,relat&lt;br /&gt;├─/sys/kernel/security     systemd-1 autofs  rw,relatime,fd=22,pgrp=1,tim&lt;br /&gt;├─/sys/kernel/debug        systemd-1 autofs  rw,relatime,fd=24,pgrp=1,tim&lt;br /&gt;└─/sys/fs/fuse/connections fusectl   fusectl rw,relatime&lt;br /&gt;&lt;/pre&gt;returns info about /sys and all /sys submounts.&lt;br /&gt;&lt;br /&gt;Now you can implement recursive umount in shell, something like:&lt;br /&gt;&lt;pre&gt;for d in $(findmnt --list --submounts $MOUNTPOINT -o TARGET -n | tac); do&lt;br /&gt;  umount $d&lt;br /&gt;done&lt;br /&gt;&lt;/pre&gt;I hope that &lt;span style="font-family:courier new;"&gt;umount(8)&lt;/span&gt; will support something like this ASAP.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-6194445067770050705?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/6194445067770050705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2011/01/findmnt8-and-submounts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/6194445067770050705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/6194445067770050705'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2011/01/findmnt8-and-submounts.html' title='findmnt(8) and submounts'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-3364081372646539147</id><published>2010-12-16T12:53:00.004+01:00</published><updated>2010-12-16T13:16:12.744+01:00</updated><title type='text'>lsblk(8)</title><content type='html'>&lt;span style="font-family:times new roman;"&gt;lsblk(8)&lt;/span&gt; is a new util that will be available in util-linux-2.19 (coming soon;-). The util lists all block devices as a tree. This output is very useful on machines with complicated storage setup (e.g. RAID, dm-crypt, ...). It's so useful that we'll probably backport &lt;span style="font-family:times new roman;"&gt;lsblk(8)&lt;/span&gt; to  RHEL-6 to make life easier for people who need to debug their systems.&lt;br /&gt;&lt;br /&gt;The original idea comes from &lt;span style="font-family:times new roman;"&gt;"dmsetup ls --tree"&lt;/span&gt;, but &lt;span style="font-family:times new roman;"&gt;lsblk(8)&lt;/span&gt; is better :-) It uses "holders" and "slaves" from /sys filesystem. This means that the util is usable without root permissions and it works for all types of block devices (dmsetup uses DM ioctls).&lt;br /&gt;&lt;br /&gt;For example my laptop with dm-crypted $HOME and partitioned RAID0 (md8) on scsi_debug device (sdc):&lt;br /&gt;&lt;pre&gt;$ lsblk&lt;br /&gt;NAME                 MAJ:MIN RA   SIZE RO MOUNTPOINT&lt;br /&gt;sda                    8:0    0  93.2G  0&lt;br /&gt;├─sda1                 8:1    0   102M  0 /mnt/test&lt;br /&gt;├─sda2                 8:2    0     1K  0&lt;br /&gt;├─sda3                 8:3    0   2.3G  0 [SWAP]&lt;br /&gt;├─sda4                 8:4    0  76.2G  0 /&lt;br /&gt;├─sda5                 8:5    0    10G  0&lt;br /&gt;│ └─kzak-home (dm-0) 253:0    0    10G  0 /home/kzak&lt;br /&gt;└─sda6                 8:6    0   4.7G  0 /boot&lt;br /&gt;sdc                    8:32   0   500M  0&lt;br /&gt;├─sdc1                 8:33   0   250M  0&lt;br /&gt;│ └─md8                9:8    0 498.9M  0&lt;br /&gt;│   ├─md8p1          259:0    0   100M  0&lt;br /&gt;│   ├─md8p2          259:1    0   100M  0&lt;br /&gt;│   └─md8p3          259:2    0 297.9M  0&lt;br /&gt;└─sdc2                 8:34   0   249M  0&lt;br /&gt;  └─md8                9:8    0 498.9M  0&lt;br /&gt;    ├─md8p1          259:0    0   100M  0&lt;br /&gt;    ├─md8p2          259:1    0   100M  0&lt;br /&gt;    └─md8p3          259:2    0 297.9M  0&lt;br /&gt;&lt;/pre&gt;You can also list more details about devices. The next example is from scsi_debug device with 4KiB sectors and enabled alignment offset:&lt;br /&gt;&lt;pre&gt;$ lsblk --topology /dev/sdb&lt;br /&gt;NAME   ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED&lt;br /&gt;sdb         3584   4096  32768    4096     512    0 cfq&lt;br /&gt;├─sdb1         0   4096  32768    4096     512    0 cfq&lt;br /&gt;└─sdb2         0   4096  32768    4096     512    0 cfq&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-family:times new roman;"&gt;lsblk(8)&lt;/span&gt; is also usable in script, for example:&lt;br /&gt;&lt;pre&gt;$ lsblk --nodeps --noheading --raw -o ALIGNMENT /dev/sdb&lt;br /&gt;3584&lt;br /&gt;&lt;/pre&gt;returns only alignment-offset for device sdb.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Thanks&lt;/span&gt; to Milan Broz (from Red Hat) who is author of the original &lt;span style="font-family:times new roman;"&gt;lsblk(8)&lt;/span&gt; prototype.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-3364081372646539147?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/3364081372646539147/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2010/12/lsblk8.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/3364081372646539147'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/3364081372646539147'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2010/12/lsblk8.html' title='lsblk(8)'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-2634231948453209612</id><published>2010-12-02T11:41:00.003+01:00</published><updated>2010-12-02T14:49:16.620+01:00</updated><title type='text'>util-linux is without -ng</title><content type='html'>The &lt;span style="font-weight: bold;"&gt;util-linux-ng&lt;/span&gt; project was officially merged into &lt;span style="font-weight: bold;"&gt;util-linux&lt;/span&gt; in last days. It means that there is no more -ng fork. Fortunately, the change was pretty simple, because the original util-linux project was inactive in last four years. It was enough to rename mailing list, git repository and directories at kernel.org. Note that the old addresses still work and all is redirected to the new stuff.&lt;br /&gt;&lt;br /&gt;The last remaining problem is to rename the mailing list at gmane.org (&lt;a href="http://news.gmane.org/gmane.linux.utilities.util-linux-ng/"&gt;http://news.gmane.org/gmane.linux.utilities.util-linux-ng/&lt;/a&gt;). I don't want to lost the list history, so the renaming seems as a better way than remove old list and add a new list (without -ng). Let's hope that gmane admins will be able to do the change.&lt;br /&gt;&lt;br /&gt;See &lt;a href="http://article.gmane.org/gmane.linux.file-systems/49137"&gt;&lt;br /&gt;http://article.gmane.org/gmane.linux.file-systems/49137&lt;/a&gt; for more details about new URLs and addresses.&lt;br /&gt;&lt;br /&gt;Thanks to Kay, Adrian, John and David.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-2634231948453209612?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/2634231948453209612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2010/12/util-linux-is-without-ng.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/2634231948453209612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/2634231948453209612'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2010/12/util-linux-is-without-ng.html' title='util-linux is without -ng'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-4418665708650733088</id><published>2010-07-15T22:26:00.002+02:00</published><updated>2010-07-15T22:46:07.746+02:00</updated><title type='text'>findmnt(8)</title><content type='html'>I released util-linux-ng 2.18 two weeks ago. There is many changes, for example completely new libmount (not stable API yet), new fsfreeze(8) and findmnt(8) utils and some important changes in fdisk(8).&lt;br /&gt;&lt;br /&gt;From my point of view the most attractive for end users is findmnt(8). This new util is a command line interface to the libmount library, the util is able to search in /etc/fstab, /etc/mtab or /proc/self/mountinfo.&lt;br /&gt;&lt;br /&gt;Default output (mounted filesystems):&lt;br /&gt;&lt;pre&gt;$ findmnt&lt;br /&gt;TARGET                       SOURCE                FSTYPE   OPTIONS&lt;br /&gt;/                            /dev/sda4             ext3     rw,noatime,errors=co&lt;br /&gt;├─/proc                      /proc                 proc     rw,relatime&lt;br /&gt;│ ├─/proc/bus/usb            /proc/bus/usb         usbfs    rw,relatime&lt;br /&gt;│ ├─/proc/sys/fs/binfmt_misc none                  binfmt_m rw,relatime&lt;br /&gt;│ └─/proc/fs/nfsd            nfsd                  nfsd     rw,relatime&lt;br /&gt;├─/sys                       /sys                  sysfs    rw,relatime&lt;br /&gt;├─/dev                       udev                  devtmpfs rw,relatime,size=197&lt;br /&gt;│ ├─/dev/pts                 devpts                devpts   rw,relatime,gid=5,mo&lt;br /&gt;│ └─/dev/shm                 tmpfs                 tmpfs    rw,relatime&lt;br /&gt;├─/boot                      /dev/sda1             ext3     rw,noatime,errors=co&lt;br /&gt;├─/home/kzak                 /dev/mapper/kzak-home ext4     rw,noatime,barrier=1&lt;br /&gt;│ └─/home/kzak/.gvfs         gvfs-fuse-daemon      fuse.gvf rw,nosuid,nodev,rela&lt;br /&gt;├─/var/lib/nfs/rpc_pipefs    sunrpc                rpc_pipe rw,relatime&lt;br /&gt;├─/mnt/foo                   //sr.net.home/foo     cifs     rw,relatime,mand,unc&lt;br /&gt;└─/mnt/test                  /dev/sda6             btrfs    rw,relatime&lt;br /&gt;&lt;/pre&gt;Get info about a mountpoint:&lt;br /&gt;&lt;pre&gt;$ findmnt /home/kzak&lt;br /&gt;TARGET     SOURCE                FSTYPE OPTIONS&lt;br /&gt;/home/kzak /dev/mapper/kzak-home ext4   rw,noatime,barrier=1,data=ordered&lt;br /&gt;&lt;/pre&gt;Get all mounted extN filesystems:&lt;br /&gt;&lt;pre&gt;$ findmnt -t ext4,ext3&lt;br /&gt;TARGET     SOURCE                FSTYPE OPTIONS&lt;br /&gt;/          /dev/sda4             ext3   rw,noatime,errors=continue,user_xattr&lt;br /&gt;/boot      /dev/sda1             ext3   rw,noatime,errors=continue,user_xattr&lt;br /&gt;/home/kzak /dev/mapper/kzak-home ext4   rw,noatime,barrier=1,data=ordered&lt;br /&gt;&lt;/pre&gt;The same thing, but from fstab:&lt;br /&gt;&lt;pre&gt;$ findmnt --fstab -t ext4,ext3&lt;br /&gt;TARGET     SOURCE                                    FSTYPE OPTIONS&lt;br /&gt;/          UUID=d3a8f783-df75-4dc8-9163-975a891052c0 ext3   noatime,defaults&lt;br /&gt;/boot      UUID=f1cd38fa-c887-4ab8-834b-c8ee659b97fe ext3   noatime,defaults&lt;br /&gt;/home/kzak /dev/mapper/kzak-home                     ext4   noatime,defaults&lt;br /&gt;&lt;/pre&gt;Don't like LABLEs/UUIDs?&lt;br /&gt;&lt;pre&gt;$ findmnt --fstab --evaluate -t ext4,ext3&lt;br /&gt;TARGET     SOURCE                FSTYPE OPTIONS&lt;br /&gt;/          /dev/sda4             ext3   noatime,defaults&lt;br /&gt;/boot      /dev/sda1             ext3   noatime,defaults&lt;br /&gt;/home/kzak /dev/mapper/kzak-home ext4   noatime,defaults&lt;br /&gt;&lt;/pre&gt;or convert UUID to mountpoint:&lt;br /&gt;&lt;pre&gt;$ findmnt -o TARGET --noheadings UUID=f1cd38fa-c887-4ab8-834b-c8ee659b97fe&lt;br /&gt;/boot&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-4418665708650733088?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/4418665708650733088/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2010/07/findmnt8.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/4418665708650733088'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/4418665708650733088'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2010/07/findmnt8.html' title='findmnt(8)'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-8408437633966523557</id><published>2010-05-12T11:49:00.003+02:00</published><updated>2010-05-12T13:00:28.423+02:00</updated><title type='text'>4096-byte sector hard drives</title><content type='html'>Maybe you're already read some blogs/articles about new 4KiB disks and Linux. These articles usually share one important thing -- &lt;span style="font-weight: bold;"&gt;WDxxEARS&lt;/span&gt; hard drives. Unfortunately, it seems that WDC made a brown-paper-bag bug here. The disks report 512-bytes physical sector size instead of 4096...&lt;br /&gt;&lt;pre&gt;hdparm -I /dev/sdb&lt;br /&gt;&lt;br /&gt;ATA device, with non-removable media&lt;br /&gt;  Model Number:       WDC WD15EARS-00Z5B1&lt;br /&gt;  Serial Number:      WD-WMAVUxxxxxxx&lt;br /&gt;  Firmware Revision:  80.00A80&lt;br /&gt;[...]&lt;br /&gt;  &lt;span style="color: rgb(153, 0, 0);"&gt;Logical/Physical Sector size:           512 bytes&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;Fortunately, &lt;a href="http://community.wdc.com/t5/Desktop/Problem-with-WD-Advanced-Format-drive-in-LINUX-WD15EARS/m-p/20675#M1245"&gt;it seems&lt;/a&gt; that newer models correctly report 4K sectors:&lt;br /&gt;&lt;pre&gt;ATA device, with non-removable media&lt;br /&gt;  Model Number:       WDC WD15EARS-00Z5B1               &lt;br /&gt;  Serial Number:      WD-WMAVUxxxxxxx&lt;br /&gt;  Firmware Revision:  80.00A80&lt;br /&gt;[...]&lt;br /&gt;  Logical  Sector size:                   512 bytes&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;  Physical Sector size:                  4096 bytes&lt;/span&gt;&lt;br /&gt;  Logical Sector-0 offset:                  0 bytes&lt;br /&gt;&lt;/pre&gt;Now the good news. Fedora-13 and all related upstream projects are ready for 4096-byte sector disks. The libparted, fdisk, mkfs.{ext[234],xfs,gfs2} and cryptsetup (upstream, Fedora-14 and RHEL6) have been enhanced to use the new I/O topology to properly align things on the devices.&lt;br /&gt;&lt;br /&gt;The I/O topology (aka "I/O limits") is supported since kernel 2.6.31. The topology is exported to userspace by sysfs, for example:&lt;br /&gt;&lt;pre&gt;  $ cat /sys/block/sdb/queue/physical_block_size&lt;br /&gt;  4096&lt;br /&gt;  $ cat /sys/block/sdb/queue/logical_block_size&lt;br /&gt;  512&lt;br /&gt;  $ cat /sys/block/sdb/queue/optimal_io_size&lt;br /&gt;  32768&lt;/pre&gt;The kernel also supports topology ioctls since 2.6.32. The parted, fdisk and mkfs.{ext,xfs} use libblkid to get the topology, but some other tools directly use ioctls. So it's better to have kernel 2.6.32 or .33.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-family:times new roman;"&gt;fdisk(8)&lt;/span&gt; command uses 1MiB offset and grain to align partitions by default. So the final partition table is usable on hard drives with 4096-byte sectors by default. It means independently on the disk topology. This is the good news for WDxxEARS users.&lt;br /&gt;&lt;br /&gt;If you want to use &lt;span style="font-family:times new roman;"&gt;fdisk(8)&lt;/span&gt; then think twice and don't forget that fdisk is a low-level tool. Some &lt;span style="font-family:times new roman;"&gt;fdiks(8)&lt;/span&gt; hints:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;use fdisk from util-linux-ng &gt;= 2.17.2&lt;/li&gt;&lt;li&gt;read warnings&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;don't use DOS-compatible mode&lt;/span&gt; (for backward compatibility this mode is enable by default, you have to use command 'c' or '-c' command line option to disable DOS mode. Note that for the next major release the DOS mode will be disable by default.)&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;use sectors as display units&lt;/span&gt; (command 'u' or '-u' command line option)&lt;/li&gt;&lt;li&gt;all default sizes/offsets are aligned to the physical block boundary (e.g. "First sector" dialog always provides aligned default)&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;use +size{M,G} convention&lt;/span&gt; to specify "Last sector"  (e.g.  +5G to create 5GiB partition) then fdiskl aligns the size to physical block boundary&lt;/li&gt;&lt;li&gt;don't forget that fdisk(8) always follows your wishes -- it means that if you explicitly define first/last sector number then the partition could be misaligned&lt;/li&gt;&lt;li&gt;the 'p' (print) command checks for partitions alignment&lt;/li&gt;&lt;/ul&gt;For more information about 4KiB sectors read:&lt;br /&gt;&lt;a href="https://ata.wiki.kernel.org/index.php/ATA_4_KiB_sector_issues"&gt;https://ata.wiki.kernel.org/index.php/ATA_4_KiB_sector_issues&lt;/a&gt;&lt;br /&gt;&lt;a href="http://people.redhat.com/msnitzer/docs/io-limits.txt"&gt;http://people.redhat.com/msnitzer/docs/io-limits.txt&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-8408437633966523557?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/8408437633966523557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2010/05/4096-byte-sector-hard-drives.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/8408437633966523557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/8408437633966523557'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2010/05/4096-byte-sector-hard-drives.html' title='4096-byte sector hard drives'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-6672221659178385992</id><published>2010-03-27T01:26:00.007+01:00</published><updated>2010-03-28T21:35:30.125+02:00</updated><title type='text'>git-pull from translationproject.org</title><content type='html'>I don't like localization services (portals) that require a write access to the upstream VCS, because distributed version control systems (e.g. git) are designed for a different type of work flow.&lt;br /&gt;&lt;br /&gt;Unfortunately, the access to VCS is a preferred method used by &lt;a href="http://transifex.net/"&gt;transifex.net&lt;/a&gt; (note that now transifex allows to pull .po files from .tar.gz and then the final translations are send by e-mail (!) to the package maintainer).&lt;br /&gt;&lt;br /&gt;So... I started to use &lt;a href="http://translationproject.org/"&gt;translationproject.org&lt;/a&gt; 3 years ago. And it works. It works very successfully without any automatic interaction with upstream VCS. The final translated .po files are available by HTTP or RSYNC. For example:&lt;br /&gt;&lt;pre&gt;  rsync  -Lrtvz  rsync://translationproject.org/tp/latest/$PROJECT/$LANG.po  po&lt;br /&gt;&lt;/pre&gt;downloads selected .po file to the po/ directory. I usually sync my private GIT repository with the latest PO stuff from translationproject.org few hours before package release. The next step after .po files download is to call &lt;span style="font-family:times new roman;"&gt;git-add&lt;/span&gt; (for new .po files) and &lt;span style="font-family:times new roman;"&gt;git-commit&lt;/span&gt;. The ideal solution is to commit with the &lt;span style="font-family:times new roman;"&gt;--author=&lt;/span&gt; option where the author name is a "Last-Translator" from PO file.&lt;br /&gt;&lt;br /&gt;Because I'm lazy, I have a &lt;a href="http://people.redhat.com/kzak/git-scripts/git-tp-sync"&gt;script&lt;/a&gt; for this task:&lt;br /&gt;&lt;pre&gt;  &lt;span style="color: rgb(153, 0, 0);"&gt;git-tp-sync &amp;lt;project-name&amp;gt; [&amp;lt;lang&amp;gt; ...]&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;And here is an example from &lt;span style="font-family:times new roman;"&gt;git-log&lt;/span&gt;:&lt;br /&gt;&lt;pre&gt;  commit d609d0fb8ba1d2302d8bfd0c85903316af83c402&lt;br /&gt;  Author: Clytie Siddall &lt;clytie@....&gt;&lt;br /&gt;  Date:   Mon Mar 22 09:36:51 2010 +0100&lt;br /&gt;&lt;br /&gt;    po: update vi.po (from translationproject.org)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://people.redhat.com/kzak/git-scripts/git-tp-sync"&gt;&lt;span style="font-size:85%;"&gt;http://people.redhat.com/kzak/git-scripts/git-tp-sync&lt;/span&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-6672221659178385992?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/6672221659178385992/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2010/03/git-pull-from-translationprojectorg.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/6672221659178385992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/6672221659178385992'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2010/03/git-pull-from-translationprojectorg.html' title='git-pull from translationproject.org'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-1477891870089389700</id><published>2010-02-03T10:58:00.005+01:00</published><updated>2010-02-03T11:57:17.741+01:00</updated><title type='text'>Highlighted patches inside mutt</title><content type='html'>Tons of patches are delivered by mailing lists. Unfortunately, there is not a native way how properly highlight patches inside mutt. This problem could be resolved by two different methods:&lt;br /&gt;&lt;br /&gt;1) &lt;span style="font-weight: bold;"&gt;call an external command&lt;/span&gt; for diffs. You need something like&lt;br /&gt;&lt;pre&gt;  text/x-diff;  cat %s | colordiff;copiousoutput&lt;br /&gt;  text/x-patch; cat %s | colordiff;copiousoutput&lt;br /&gt;&lt;/pre&gt;in your &lt;span style="font-style: italic;"&gt;~/.mailcap&lt;/span&gt; and&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_eio3phLcog8/S2lTx7rvAYI/AAAAAAAAAAM/JkUYNLgxGrs/s1600-h/mutt-colordiff.png"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 272px; height: 320px;" src="http://2.bp.blogspot.com/_eio3phLcog8/S2lTx7rvAYI/AAAAAAAAAAM/JkUYNLgxGrs/s320/mutt-colordiff.png" alt="" id="BLOGGER_PHOTO_ID_5433966542699037058" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;pre&gt;  auto_view text/x-diff&lt;br /&gt;  auto_view text/x-patch&lt;br /&gt;  set allow_ansi&lt;br /&gt;&lt;/pre&gt;in your &lt;span style="font-style: italic;"&gt;~/.muttrc&lt;/span&gt;. Unfortunately this method sucks, because a lot of patches are distributed in the body of the mail. Note that the mail body is usually better for patches that attachments (see &lt;a href="http://userweb.kernel.org/%7Eakpm/stuff/tpp.txt"&gt;The Perfect Patch&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;2) &lt;span style="font-weight: bold;"&gt;use mutt highlighting&lt;/span&gt;. This method is also not perfect, but I use it for years and I am very happy with it. You need to add&lt;br /&gt;&lt;pre&gt;  color body green default "^diff \-.*"&lt;br /&gt;  color body green default "^index [a-f0-9].*"&lt;br /&gt;  color body green default "^\-\-\- .*"&lt;br /&gt;  color body green default "^[\+]{3} .*"&lt;br /&gt;  color body cyan default "^[\+][^\+]+.*"&lt;br /&gt;  color body red  default "^\-[^\-]+.*"&lt;br /&gt;  color body brightblue default "^@@ .*"&lt;br /&gt;&lt;/pre&gt;to you &lt;span style="font-style: italic;"&gt;~/.muttrc&lt;/span&gt;.  That's all :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-1477891870089389700?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/1477891870089389700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2010/02/highlighted-patches-inside-mutt.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/1477891870089389700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/1477891870089389700'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2010/02/highlighted-patches-inside-mutt.html' title='Highlighted patches inside mutt'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_eio3phLcog8/S2lTx7rvAYI/AAAAAAAAAAM/JkUYNLgxGrs/s72-c/mutt-colordiff.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-2078109548508839998</id><published>2010-01-08T15:09:00.002+01:00</published><updated>2010-01-08T15:36:01.478+01:00</updated><title type='text'>util-linux-ng 2.17</title><content type='html'>I released v2.17 this morning (CET). A few numbers about the release:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;404 patches&lt;/li&gt;&lt;li&gt;488 files changed, 66816 insertions, 48504 deletions&lt;/li&gt;&lt;li&gt;41 developers&lt;/li&gt;&lt;li&gt;22 developers contributed first time&lt;/li&gt;&lt;li&gt;5 months&lt;/li&gt;&lt;/ul&gt;Thanks to all &lt;a href="http://git.kernel.org/?p=utils/util-linux-ng/util-linux-ng.git;a=blob_plain;f=AUTHORS"&gt;contributors&lt;/a&gt;!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Release highlights&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;fallocate&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;this NEW COMMAND is a command line interface to fallocate Linux syscall and allows to preallocate blocks to a file.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-family:times new roman;"&gt;unshare&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;this NEW COMMAND is a command line interface to unshare Linux syscall and allows to run program with some namespaces unshared from parent.&lt;/li&gt;&lt;/ul&gt;wipefs&lt;br /&gt;&lt;ul&gt;&lt;li&gt;this NEW COMMAND is based on libblkid and allows to remove filesystem or RAID signatures from a device.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-family:times new roman;"&gt;libblkid&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;libblkid allows to gather information about block device topology, currently supported methods are:&lt;/li&gt;&lt;ul style="text-align: left;"&gt;&lt;li&gt;      ioctl - supported since kernel 2.6.32&lt;/li&gt;&lt;li&gt;sysfs - supported since kernel 2.6.31&lt;/li&gt;&lt;li&gt;fallback for DM, MD, LVM and EVMS on old kernels (base on code from xfsprogs/libdisk)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;The topology support is mostly designed for mkfs programs or partitioning tools (already used in mkfs.xfs, mkex2fs, libparted and fdisk)&lt;br /&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;libblkid supports partition tables parsing (currently supported are aix, bsd, dos, mac, gpt, minix, sgi, solaris, sun and unixware). This functionality is designed for mkfs programs, DeviceKits, [k]partx or so.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;libblkid API documentation is available at http://ftp.kernel.org/pub/linux/utils/util-linux-ng/libblkid-docs/&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-family:times new roman;"&gt;blockdev&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;supports all new topology ioctls&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-family:times new roman;"&gt;fdisk&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt; aligns newly created partitions to minimum_io_size boundary ("minimum_io_size" is physical sector size or stripe chunk size on RAIDs).&lt;/li&gt;&lt;li&gt; supports disks with alignment_offset now.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Complete ReleaseNotes:&lt;/span&gt;&lt;br /&gt;&lt;a href="ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/v2.17/v2.17-ReleaseNotes"&gt;ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/v2.17/v2.17-ReleaseNotes&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Tarball:&lt;/span&gt;&lt;br /&gt;&lt;a href="ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/v2.17/util-linux-ng-2.17.tar.bz2"&gt;ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/v2.17/util-linux-ng-2.17.tar.bz2&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-2078109548508839998?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/2078109548508839998/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2010/01/util-linux-ng-217.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/2078109548508839998'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/2078109548508839998'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2010/01/util-linux-ng-217.html' title='util-linux-ng 2.17'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-1844191913965342624</id><published>2009-12-09T15:36:00.003+01:00</published><updated>2009-12-09T16:05:31.744+01:00</updated><title type='text'>unshare(1)</title><content type='html'>The &lt;span style="font-family:times new roman;"&gt;unshare(1)&lt;/span&gt; is a new command line interface to unshare Linux syscall and allows a program to run with some parts of the process execution context unshared from parent.  This new command is available in &lt;a href="ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/v2.17/"&gt;util-linux-ng 2.17&lt;/a&gt; (thanks to Mikhail Gusarov who is author of the command).&lt;br /&gt;&lt;br /&gt;Currently, the &lt;span style="font-family:times new roman;"&gt;unshare(1)&lt;/span&gt; command allows to disassociates:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;mount namespace&lt;/li&gt;&lt;li&gt;UTS (since kernel 2.6.19, independent hostname and domainname)&lt;/li&gt;&lt;li&gt;IPC namespace (System V message queues, semaphores, and shared memory)&lt;/li&gt;&lt;li&gt;network namespace (since kernel 2.6.24, independent IP stacks, IP routing tables, firewall, ...)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Probably the most attractive is unshared mount namespace (see Mike Hommey's "&lt;a href="http://glandium.org/blog/?p=217"&gt;newns&lt;/a&gt;" or pam_namespace).&lt;br /&gt;&lt;br /&gt;For example I have two xterms, let's start a new &lt;span style="font-family:times new roman;"&gt;bash&lt;/span&gt; with unshared mount namespace in the first session:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Session1:&lt;/span&gt;&lt;pre&gt;&lt;br /&gt;  # &lt;span style="color: rgb(102, 0, 0);"&gt;unshare --mount  /bin/bash&lt;/span&gt;&lt;br /&gt;  # mount /dev/sda1 /mnt/test&lt;br /&gt;  # grep test /proc/mounts&lt;br /&gt;  /dev/sda1 /mnt/test ext3 rw,relatime,errors=continue,user_xattr,acl,data=ordered 0 0&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;Session2:&lt;/span&gt;&lt;pre&gt;&lt;br /&gt;  # grep test /proc/mounts&lt;br /&gt;  # ll /mnt/test&lt;br /&gt;  total 0&lt;br /&gt;&lt;/pre&gt;... the /mnt/test filesystem is visible in the Session1 only. That's all,  pretty simple and pretty useful :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-1844191913965342624?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/1844191913965342624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2009/12/unshare1.html#comment-form' title='25 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/1844191913965342624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/1844191913965342624'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2009/12/unshare1.html' title='unshare(1)'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>25</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-704574158893359740</id><published>2009-11-25T17:06:00.003+01:00</published><updated>2009-11-25T17:38:50.927+01:00</updated><title type='text'>wipefs(8)</title><content type='html'>This new command from &lt;a href="ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/v2.17/"&gt;util-linux-ng-2.17&lt;/a&gt; is user friendly solution for people who have block devices with more valid filesystem signatures.&lt;br /&gt;&lt;br /&gt;It's usually mkfs bug when old signatures are not removed from the device. The situation when you have more signatures on the device could be pretty dangerous. For example you can call &lt;span style="font-family:times new roman;"&gt;swapon(8)&lt;/span&gt; for a wrong device and lost your data (see fedora bug &lt;a href="https://bugzilla.redhat.com/show_bug.cgi?id=473514"&gt;#473514&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;The libblkid was fixed few months ago and it does not return ambivalent information now. All devices with more signatures are ignored (well, there is exception for RAIDs, volume managers and some special filesystems like iso9660 and UDF). The &lt;span style="font-family: times new roman;"&gt;blkid(8)&lt;/span&gt; command returns:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;# blkid -p /dev/loop0&lt;br /&gt;/dev/loop0: ambivalent result (probably more filesystems on the device)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now imagine that you have data on the device, what next?&lt;br /&gt;&lt;br /&gt;Use &lt;span style="font-family: times new roman;"&gt;dd(1)&lt;/span&gt; and &lt;span style="font-family: times new roman;"&gt;hexdump(1)&lt;/span&gt;... well that's joke :-) &lt;span style="font-family: times new roman;"&gt;&lt;/span&gt;Use &lt;span style="font-family: times new roman;"&gt;wipefs(8)&lt;/span&gt; and remove old (unwanted) filesystem signature.&lt;br /&gt;&lt;br /&gt;The command without any option lists details about all detected filesystems:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;# wipefs /dev/loop0&lt;br /&gt;offset               type&lt;br /&gt;----------------------------------------------------------------&lt;br /&gt;0xff6                swap   [other]&lt;br /&gt;                     UUID:  da6c54ea-77d9-470a-82f1-e793fd5d9131&lt;br /&gt;&lt;br /&gt;0x36                 vfat   [filesystem]&lt;br /&gt;                     UUID:  497F-3013&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now remove unwanted swap signature:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;# wipefs --offset 0xff6  /dev/loop0&lt;br /&gt;10 bytes [53 57 41 50 53 50 41 43 45 32] erased at offset 0xff6 (swap)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The &lt;span style="font-family: times new roman;"&gt;wipefs(8)&lt;/span&gt; command does not erase whole filesystem superblock or so. It removes magic strings only.  Now the device is useful for &lt;span style="font-family: times new roman;"&gt;blkid(8)&lt;/span&gt;:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;# blkid -p /dev/loop0&lt;br /&gt;/dev/loop0: SEC_TYPE="msdos" UUID="497F-3013" VERSION="FAT12" TYPE="vfat" USAGE="filesystem"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The other change in util-linux-ng-2.17 is that detailed information about ambivalent probing results are reported to udevd (&lt;span style="font-family: times new roman;"&gt;$ID_FS_AMBIVALEN&lt;/span&gt; variable) so it will be possible to notify users by UI (e.g. Palimpsest).&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-704574158893359740?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/704574158893359740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2009/11/wipefs8.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/704574158893359740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/704574158893359740'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2009/11/wipefs8.html' title='wipefs(8)'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7921326074980135918.post-6017691210010555926</id><published>2009-11-12T22:04:00.004+01:00</published><updated>2009-11-12T23:23:50.048+01:00</updated><title type='text'>libblkid</title><content type='html'>I think I can say that filesystem probing (identification) code in Linux distributions has been successfully consolidated to the one library. The libblkid.&lt;br /&gt;&lt;br /&gt;The library is Ted Tso's baby and was maintained and distributed within e2fsprogs package for many years. Unfortunately, the library didn't match with udev requirements. The udev project requires lightweight probing library without any high-level logic. This was reason why udev developers created a new probing library -- libvolume_id.&lt;br /&gt;&lt;br /&gt;And finally and unfortunately there was very old filesystem probing code in the mount(8) utility too. The useless code in mount(8) was ignored by mainstream Linux distributions (for example Suse linked their utils against libvolume_id and RHEL/Fedora against libblkid) .... and this is not end of nightmare.&lt;br /&gt;&lt;br /&gt;The other filesystem probing code was in xfsprogs project (libdisk), and the other code is still in the parted (libparted).&lt;br /&gt;&lt;br /&gt;And now about consolidation. The libblkid was merged into util-linux-ng (one year ago). The old version in e2fsprogs is still maintained for people who are very conservative. All new features go to libblkid in util-linux-ng project.&lt;br /&gt;&lt;br /&gt;Some important functionality from libvolume_id was merged into libblkid including a new low-level API. The blkid(8) command supports new "-p" (low-level probe) and "-o udev" (udev output format) options now.&lt;br /&gt;&lt;br /&gt;The libvolume_id was completely removed from udev project a few months ago. The mount(8) command uses only libblkid.&lt;br /&gt;&lt;br /&gt;The libblkid has been heavily extended in the latest (incoming) util-linux-ng-2.17. It supports partition tables probing and allows to gather information about blkdev topology. This latest change allows to use libblkid instead of libdisk in mkfs programs (already in mke2fs and mkfs.xfs).&lt;br /&gt;&lt;br /&gt;And finally libparted could be linked against libblkid. Currently, it uses libblkid for topology information only, but I hope one day it will use it for filesystems probing too.&lt;br /&gt;&lt;br /&gt;The last remaining place where is any filesystem probing code is cfdisk. It will be fixed in some next util-linux-ng release.&lt;br /&gt;&lt;br /&gt;So... now is excellent opportunity to say THANKS to Ted (e2fsprogs), Kay (udev), Christoph (xfsprogs) and to others who help me with this task.&lt;br /&gt;&lt;br /&gt;[&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight:bold;"&gt;...yeah, this is my first blog post ... and yeah, my English is horrible:-)&lt;/span&gt;&lt;/span&gt;]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7921326074980135918-6017691210010555926?l=karelzak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://karelzak.blogspot.com/feeds/6017691210010555926/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://karelzak.blogspot.com/2009/11/libblkid.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/6017691210010555926'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7921326074980135918/posts/default/6017691210010555926'/><link rel='alternate' type='text/html' href='http://karelzak.blogspot.com/2009/11/libblkid.html' title='libblkid'/><author><name>Karel Zak</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry></feed>
