Posts Tagged ‘filesystem’

Ubuntu Recovery mode with internet connection and read write filesystem

December 2, 2014 Leave a comment

I’ve upgraded my box to a fresh Gnome Ubuntu 14.10 install. After installing some packages, and rebooting several times, I faced an error when rebooting and I cannot start the system.

I tryed the recovery option, but my system was unable to start in graphics mode, I can only get into a sudo console.

I was pretty sure that is a package recently installed that crashed my system. So I entered in a sudo console in recovery mode.

This console mounts the / filesystem in read-only mode. I needed to update the packages installed, so I also need a network connection in recovery mode. Here’s how I get it done:

mount -o remount, rw /

ifconfig eth0 up

dhclient eth0

First command is to mount the / filesystem in read write option (obviously). The second command raises up the ethernet device, and the third one sets an IP to the eth0 device using DHCP.
Then, I was able to recover my system with a dist-upgrade:

apt-get dist-upgrade

Do you have the same problem? Please, leave your comments below.



Create an encrypted filesystem with luks on ubuntu

November 15, 2010 2 comments

Setting up a LUKS filesystem ( on Ubuntu 10.10 is as easy as this:

$ sudo apt-get install -y cryptsetup
$ sudo modprobe sha256
$ sudo modprobe dm_crypt
$ sudo modprobe dm_mod
$ sudo modprobe aes

Now you have to ensure that the device (in my case, an USB hard disk drive) is unmounted:

$ sudo umount /dev/sdb1

Once unmounted, you can setup LUKS on a free partition. Be careful, all data will be erased, and remember the password!:

$ sudo cryptsetup luksFormat -c aes -h sha256 /dev/sdb1

This will overwrite data on /dev/sdb1 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:

Now you can mount and format the new partition, giving a name to the device mapper):

$ sudo cryptsetup luksOpen /dev/sdb1 encrypted_disk
Enter passphrase for /dev/sdb1:
Key slot 0 unlocked.
$ sudo mkfs.ext3 /dev/mapper/encrypted_disk

$ sudo mkdir /test_dir
$ sudo mount -t ext3 /dev/mapper/encrypted_disk /test_dir/

Be careful with the / at the end of the mounting dir (/test_dir/).

To unmount the disk, you have to close the device mapper:

$ sudo umount /encrypted_disk
$ sudo cryptsetup luksClose encrypted_disk

Updated feb-22 2011

If you want your LUKS partition to be compatible with Red Hat 5, when you format the disk you have to use sha1 instead of sha256:

$ sudo cryptsetup luksFormat -c aes -h sha1 /dev/sdb1

Once the LUKS partition is ready, the partition is mounted automatically, asking for the LUKS password only.