Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

2012-12-30

Migrate /home in Ubuntu

Sadly Ubuntu does not have LVM enabled in the default install, as this whole issue would be solved with a simple pvmigrate and lvresize...

My /home (which is on a separate /dev/sda5 partition) is filling up.
The availability of Steam on Linux gave it the final blow: it's time to bring in another partition.
As I don't want to commit a whole partition to /home, I've mounted /dev/sdc2 as /space and I'm going to create a symlink to an home subdirectory.

First, boot Ubuntu in rescue mode and select root shell.

Mount all filesystems

#mount -a

note that mounted filesystem won't be visible with a df, but you should cat /proc/mounts to see them
Set proper permission to the new partition

#chown root:root /space
#chmod 755 /space

Then create the new home and copy the old one

#mkdir /space/home
#cp -a /home/* /space/home/

Mount / read/write as we'll need to modify the fstab

#mount / -o rw,remount
#vi /etc/fstab

Comment the old /home
Remove the old home mount point and create the new symlink

#umount /home
#rmdir /home
#ls -s /space/home /home

Reboot

2012-10-15

Mounting a disk image

Dumping a full disk is a quick way to perform a backup:

# dd if=/dev/sdb of=filename.dsk

But once you have such a dump, you can't directly mount it, you must use kpartx:

# kpartx -av filename.dsk
add map loop0p1 (252:0): 0 7830408 linear /dev/loop0 1144

You can see the partitions with fdisk

# fdisk -l /dev/loop0

Disk /dev/loop0: 4009 MB, 4009754624 bytes
128 heads, 22 sectors/track, 2781 cylinders, total 7831552 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc3072e18

      Device Boot      Start         End      Blocks   Id  System
/dev/loop0p1   *        1144     7831551     3915204    b  W95 FAT32


Now you can mount the partitions that are inside the disk image.

# mount /dev/mapper/loop0p1 /mnt
# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/sda5             31G   12G   18G  41% /
udev                 3.9G  8.0K  3.9G   1% /dev
tmpfs                1.6G  960K  1.6G   1% /run
none                 5.0M     0  5.0M   0% /run/lock
none                 3.9G  200K  3.9G   1% /run/shm
/dev/sdb5             20G  1.4G   18G   8% /home
/dev/mapper/loop0p1  3.8G  1.1G  2.7G  29% /mnt


Once you've done, you can umount it with

# umount /mnt
# kpartx -dv filename.dsk
del devmap : loop0p1
loop deleted : /dev/loop0


Note:
Ubuntu doesn't have kpartx installed by default:

# sudo apt-get install kpartx


2012-04-29

Unity redemption?

So, I wasn't at fault when I criticized Unity Launcher: 12.04 introduces the top-left-corner activation that solves the "browser back button" syndrome.


2011-12-22

Ubuntu-style Putty

Designing a custom font was a stroke of genius from the Ubuntu team.
It gave instant recognisability to the distribution and it boosted ergonomics as well.

I'm currently using the same font even on Windows in my Putty sessions:



The Ubuntu fonts can be downloaded from http://font.ubuntu.com/
Unzip and copy into the Windows fonts folder.
Set Putty to use "Ubuntu Mono 12" with the Antialiased flag.

Here's the reg file for the above configuration:

--- CUT HERE ---

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\Default%20Settings]
"Font"="Ubuntu Mono"
"FontIsBold"=dword:00000000
"FontCharSet"=dword:00000000
"FontHeight"=dword:0000000c
"FontVTMode"=dword:00000004
"UseSystemColours"=dword:00000000
"TryPalette"=dword:00000000
"BoldAsColour"=dword:00000001
"Colour0"="187,187,187"
"Colour1"="255,255,255"
"Colour2"="45,15,44"
"Colour3"="85,85,85"
"Colour4"="0,0,0"
"Colour5"="0,255,0"
"Colour6"="0,0,0"
"Colour7"="85,85,85"
"Colour8"="187,0,0"
"Colour9"="255,85,85"
"Colour10"="0,187,0"
"Colour11"="85,255,85"
"Colour12"="187,187,0"
"Colour13"="255,255,85"
"Colour14"="0,150,187"
"Colour15"="85,170,255"
"Colour16"="187,0,187"
"Colour17"="255,85,255"
"Colour18"="0,187,187"
"Colour19"="85,255,255"
"Colour20"="187,187,187"
"Colour21"="255,255,255"
"BoldFont"=""
"BoldFontIsBold"=dword:01000000
"BoldFontCharSet"=dword:00000007
"BoldFontHeight"=dword:00000000
"WideFont"=""
"WideFontIsBold"=dword:00000003
"WideFontCharSet"=dword:00000000
"WideFontHeight"=dword:0000000a
"WideBoldFont"=""
"WideBoldFontIsBold"=dword:00000000
"WideBoldFontCharSet"=dword:00000000
"WideBoldFontHeight"=dword:343232e8
"ShadowBold"=dword:00000000
"ShadowBoldOffset"=dword:00000001
"FontQuality"=dword:00000003
"ANSIColour"=dword:00000001

--- CUT HERE ---