Determine existing journal size on an Internal journal for EXT3 / EXT4 / LDISKFS file systems

Just a quick note about figuring out existing internal journal sizes for EXT3 / EXT4 and LDISKFS file systems:

First thing to do is determine the current inode block, this is usually inode 8, however this may change depending on the file system, so it’s worth checking for sure:

# tune2fs -l /dev/sdXY | grep -i "journal inode"

This command returns the inode at which the journal resides

Journal inode: 8

Next you’ll need to probe that inode directly with the debugfs tool. This can be done with the following commands

debugfs /dev/sdXY
debugfs 1.42.9 (4-Feb-2014)
debugfs: stat <8>

Which results in the following output:

Inode: 8   Type: regular    Mode:  0600   Flags: 0x80000
Generation: 0    Version: 0x00000000:00000000
User:     0   Group:     0   Size: 134217728
File ACL: 0    Directory ACL: 0
Links: 1   Blockcount: 262144
Fragment:  Address: 0    Number: 0    Size: 0
 ctime: 0x54278f31:00000000 -- Sat Sep 27 22:31:45 2014
 atime: 0x54278f31:00000000 -- Sat Sep 27 22:31:45 2014
 mtime: 0x54278f31:00000000 -- Sat Sep 27 22:31:45 2014
crtime: 0x54278f31:00000000 -- Sat Sep 27 22:31:45 2014
Size of extra inode fields: 28
EXTENTS:
(0-32766):2655233-2687999, (32767):2688000

What we’re interested in here, is the Blockcount

Links: 1   Blockcount: 262144

So in this case we have 262144, 4096 byte blocks, which equals 128 megabytes

Also, on some newer versions of debugfs, the tool will calculate the size of the inode based on block count. This calculation can be seen in the Size: field

User:     0   Group:     0   Size: 134217728

Rsync snapshots / rolling backups

Today I had the task of updating my backup system, for a long time I didn’t bother rolling backups because, well I just didn’t care. However I now wanted to set something up. I remembered long ago that I had done this before, based on the excellent, albeit dated write up from Mike Rubel. After some hacking I rewrote his script to make it a bit more useful in my environment. The script now accepts a single argument, which points to a configuration file. To download the initial version of this tool I called ‘snapshots’ click on the link below.

snapshots.tar.gz

My Dell XPS 13 `sputnik’ Linux configuration

So, back in September I decided to purchase a new laptop, the one I decided on was the Dell XPS 13 Sputnik (9333). This is an Intel Core i7, 8GB RAM, 256GB mSATA based laptop which ships with Ubuntu 12.04 LTS.

Dell_XPS_13_Sputnik_3_Large

My first thoughts on this laptop are positive, in general the build quality is high, screen looks great, as fast (very fast for such a thin ultrabook). That said the unit initially shipped to me suffered from the dreaded coil whine issue discussed on this thread, as well as a few other issues which, with the help of others I’ve been able to solve pretty quickly.

There’s a great blog which details most of the things which you need to take care of to get this system working well. That said there’s a few more things that you’ll need to do. If you’re like me, you’ve probably blown away the stock OS, and installed something more recent.

First thing I did was modify the als.sh script on the xps13 blog:

--- als.sh      2014-10-15 22:20:26.592234453 -0600
+++ /usr/local/bin/als.sh       2014-10-11 23:37:33.150956572 -0600
@@ -85,15 +85,17 @@
 fi
 
 # Check idle time
-. /usr/share/acpi-support/power-funcs
-getXuser
-currIdleTime=`su $XUSER -c "dbus-send --session --dest=org.freedesktop.ScreenSaver \
-                            --type=method_call --print-reply --reply-timeout=1000 \
-                            /ScreenSaver org.freedesktop.ScreenSaver.GetSessionIdleTime \
-                            | grep uint32 | sed 's:.*uint32 \+\([0-9]\+\).*:\1:g'"`
-if [ $currIdleTime -gt $idleTimeout ]; then
-    echo "Timeout expired, ignoring ambient light changes"
-    exit 0
+if [ -f /usr/share/acpi-support/power-funcs ]; then
+       . /usr/share/acpi-support/power-funcs
+       getXuser
+       currIdleTime=`su $XUSER -c "dbus-send --session --dest=org.freedesktop.ScreenSaver \
+                                   --type=method_call --print-reply --reply-timeout=1000 \
+                                   /ScreenSaver org.freedesktop.ScreenSaver.GetSessionIdleTime \
+                                   | grep uint32 | sed 's:.*uint32 \+\([0-9]\+\).*:\1:g'"`
+       if [ $currIdleTime -gt $idleTimeout ]; then
+           echo "Timeout expired, ignoring ambient light changes"
+           exit 0
+       fi
 fi
 
 # Use xbacklight if the given path is wrong
@@ -115,6 +117,7 @@
         fi
         for i in `seq $curr $incr $target`; do
             echo $i > $backlightPath
+            echo $i > /tmp/als_state
             sleep $timeout
         done
     else
@@ -129,4 +132,4 @@
         break
     fi
     j=$(($j+1))
-done
\ No newline at end of file
+done

Effectively the patch above simply checks to see if power-funcs  actually exists.

Next I upgraded to 3.17 kernel. This solved problems with white noise, as well as wireless stability issues.

After that you’ll want to disable power features on the mSATA SSD by creating /etc/pm/config.d/hook_blacklist.conf and adding the following line:

HOOK_BLACKLIST="95hdparm-apm sata_alpm"

 

After some discovery, I found that not all power control features are here. A large number of them are stored in /etc/power.d/10-power_script. you’ll want to patch this file to omit the features which will adversely affect the SSD

--- power.d/10-power_script     2014-10-18 15:34:15.820269065 -0600
+++ power.d/10-power_script     2014-10-18 15:33:08.976265876 -0600
@@ -41,16 +41,16 @@
 #echo $GOVERNOR > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
 
 # Enable SATA link power Managmenet for host0
-echo $SATA > /sys/class/scsi_host/host0/link_power_management_policy
+#echo $SATA > /sys/class/scsi_host/host0/link_power_management_policy
 
 # Enable SATA link power Managmenet for host1
-echo $SATA > /sys/class/scsi_host/host1/link_power_management_policy
+#echo $SATA > /sys/class/scsi_host/host1/link_power_management_policy
 
 # Enable SATA link power Managmenet for host2 - it used to slow down keyboard typing
-echo $SATA > /sys/class/scsi_host/host2/link_power_management_policy
+#echo $SATA > /sys/class/scsi_host/host2/link_power_management_policy
 
 # Enable SATA link power Managmenet for host3
-echo $SATA > /sys/class/scsi_host/host3/link_power_management_policy
+#echo $SATA > /sys/class/scsi_host/host3/link_power_management_policy
 
 # Autosuspend for USB device Synaptics Large Touch Screen [SYNAPTICS]
 findPath 06cb 0af8
@@ -79,7 +79,7 @@
 echo $CONTROL > /sys/bus/pci/devices/0000:00:1f.3/power/control
 
 # Runtime PM for PCI Device Intel Corporation Lynx Point-LP SATA Controller 1 [AHCI mode]
-echo $CONTROL > /sys/bus/pci/devices/0000:00:1f.2/power/control
+#echo $CONTROL > /sys/bus/pci/devices/0000:00:1f.2/power/control
 
 # Runtime PM for PCI Device Intel Corporation Haswell-ULT Integrated Graphics Controller
 echo $CONTROL > /sys/bus/pci/devices/0000:00:02.0/power/control

Lastly, I had to upgrade xserver-xorg-video-intel to at least version 2.99.916 to ensure that resume would function correctly.