Friday, August 19, 2011

How to get your full disc space back on ext filesystems

You may have already wondered why you can't use the full disc space on an ext2/3/4 partition? You already seen something like this, where the used and available blocks don't fit the number of blocks on the device/partition:
Filesystem 1K-blocks   Used    Available Use%  Mounted on
/dev/sdc1   15391664  38184   14571608      1%  /mnt
The reason is: if you create an ext filesystem (no matter if with mkfs or YaST), 5 % of the filesystem get reserved for the super-user to allow e.g. root daemons to continue to write to the partition after unprivileged processes stopped because the partition is full.
While this perfectly make sense on system partitions as '/', it makes no sense on data partitions or external media (in the most cases). By this you get e.g. on an external 2TB/1.8TiB drive 100GByte/~92GiB, which you can't use as normal user. But you can get this space back. Either you set the number of reserved blocks to zero when you create the file system:
mkfs -t ext4 -m 0 /dev/sdc1
or you do it later:
# make sure partition is unmounted
umount /mnt
tune2fs -m 0 /dev/sdc1
On a LUKS encrypted  you have to do this:
# on a LUKS device
umount /media/disk
tune2fs -m 0 /dev/mapper/udisks-luks-uuid-X
 You should see this output:
tune2fs 1.41.14 (22-Dec-2010)
Setting reserved blocks percentage to 0% (0 blocks)
 And if you mount the device again, you can see with df that you have the full space available:
 Filesystem 1K-blocks   Used    Available Use%  Mounted on
 /dev/sdc1   15391664  38184   15353480      1%  /mnt

Wednesday, August 17, 2011

Update for extundelete

Today I've submitted a new extundelete package to my repo with following fixes:
  • added man(8) page to the package
  • fixed --help output to print also info about --restore-directory
  • added --dump-names option to search for - and print the full name of - deleted and (potentially fully) recoverable files on a given partition 
Feel free to test and report problems back. The package is now also part of the filesystems project.

Tuesday, August 09, 2011

How to undelete files from ext3/ext4

Sometimes, especially on the command line, it happens that you delete a file or directory you didn't really plan to delete. A second after hit enter you realize what you have done, maybe you are fast enough to stop the deletion process and save some files, but in the most cases it's already to late, at least for some files.  If you have no or a too old backup you're screwed. 
If you use ext3/ext4 you may be able to recover the file with ext3grep or extundelete with information from the file system journal if the content of the file wasn't already overwritten by new data. 
The first step should be to stop all writing processes on the related partition and unmount that partition as soon as possible. Now you have the choice: if your partition uses ext4 you have to use extundelete, if it's ext3 you can use also ext3grep. Personally, I prefer extundelete, since it supports both file systems and seems on one hand much faster to me than ext3grep and it's also easier to use on the other hand. Due to that, the following examples are for extundelete (you can find a ext3grep How-To here).
If you know the path and the name of the file (let's assume it's /home/tux/cv.tex and /dev/sda4 is mounted to /home) you deleted, switch to root and go to a partition with enough free space to store the deleted files. Then:
# extundelete need the relative file path 
me:/tmp # extundelete --restore-file tux/cv.tex /dev/sda4
As soon as extundelete finished, you'll find the recovered file in /tmp/RECOVERED_FILES/tux/ .
If you deleted more than one file in a directory or a directory itself, you can use --restore-directory :
# extundelete need the relative dir path 
me:/tmp # extundelete --restore-directory tux/Documents/tex/ /dev/sda4
There are some more useful options as --restore-all , --restore-files, --after 'dtime' or --before 'dtime', but in the most cases the two examples above should be enough. You can find both tools in my buildservice repository.

Updated xinput_calibrator packages

Today I found some time to update the xinput_calibrator packages in my buildservice repository. The new version is 0.7.5. And since someone asked in my last post for 11.4 rpms, I've activated the build also for openSUSE 11.4. 
Feel free to test and report back if you have any trouble with the updated version.

Monday, August 30, 2010

How to calibrate your TabletPC

Since a while e.g. the X11 driver for Wacom tablets should work out of the box, no calibration needed. I didn't test other tablet/touchscreen drivers in the last time, but I assume also some other should work out of the box. But sometimes you still need to calibrate your device.

But how do you calibrate e.g. your wacom tablet on a openSUSE 11.3 or Factory, since there is no wacomcpl anymore in the package, which was used in the past? And how about a evdev based device? Simply use xinput_calibrator. You can get the package for openSUSE from my openSUSE buildservice repo. 

After installation follow these steps on shell:
# check if xinput_calibrator found any device
user@tablet:~> xinput_calibrator --list
Device "Wacom ISDv4 90 Pen" id=10

# start calib.: for multiple devices use --device option
user@tablet:~> xinput_calibrator
You get this screen, follow the instructions:
You get some output with some instructions as soon as you finished the procedure. The preferred way to setup the tablet/touchscreen with the calibration data is coping a snippet from the output into '/etc/X11/xorg.conf.d/99-calibration.conf' (as root). Here an example for such a snippet:
Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "Wacom ISDv4 90 Pen"
        Option  "MinX"  "0"
        Option  "MaxX"  "28606"
        Option  "MinY"  "0"
        Option  "MaxY"  "17876"
EndSection
You may need to restart your X-server after setting up the file. If it doesn't work checkout the instructions in the output for other ways to setup the changes.
Tech Tags:

Thursday, August 19, 2010

Hacking osc (4)

Here's what some of the major stuff I did on osc in the last weeks:
  • changed 'osc request revoke' (and also reopen, accept, decline, wipe, revoke) to check the actual state and ask the user to prevent set the same state twice [1]
  • added new command 'osc requestmaintainership' as shortcut for 'osc creq -a add_role USER maintainer PROJECT PACKAGE' since this command is hard to find for (new) users [2]
  • changed 'osc request show' to show add_role request info more verbose including requested person/group and the requested role [3]
  • fix output of 'osc buildinfo' if parameters are missing, show only the available repos (and not the arch) if called from a checked out package [4]
  • updated osc.complete, added all existing commands to list [5]
  • added new command 'osc distributions' to get info about active distributions [6]
  • some changes to respect 'osc -A' and to reuse apiurl instead of reading it again and again from config [7][8]
  • changed 'osc repos' to filter out disabled repos of a package [9]
Tech Tags:

Wednesday, July 21, 2010

[Update] openSUSE: new wiki, and now ...


Some updates about the new openSUSE wiki issues:
  • The User:* pages are now finally protected (see bnc#409520 for history).
  • Looks as if the Special:Import is now finally working also for normal users.
That are good news, but there are some other issues with the wikki: 
  • As already pointed out by some other (e.g. in the 5th comment on this post): older external links to wikipages don't work anymore and there is no hint on the 'empty' page that there is a new wiki with a new structure and where you can find the old wiki. That's really annoying! But there is a info one some pages in the old wiki where to find the new pages (as e.g. here), we need something like that in the new wiki with info where the page was moved. At least as long as this page is empty.
  • Also the 'google index' is destroyed. If you e.g. search at google.com for 'opensuse nvidia' you find this result on the second place, but the page doesn't exist. Sorry, but it was really a stupid idea to do this change and breaking the google index (and external links) with it.
  • I know the intention was to cleanup the old wiki and give it a new structure, but the way it was done makes it really hard for the users. If a user look for the replacement of the old Nvidia page in the new wiki, there is no result with the default search, since it was moved to SDB:NVIDIA. You have to enable the search for the SDB namespace manually. IMO this should be activated by default.
  • Not sure about the plans for the new structure of the wiki atm, have to search for some information about it. But there are some pages missing which are used in the URL-field of old and new (openSUSE 11.3/Factory) rpms. One example is the patterns page (e.g. from the patterns-openSUSE* rpms) and I assume there are others.
Tech Tags: