Monday, January 21, 2013

Linux liveCD for unencrypted partition access

Q: Have you ever needed to manipulate the data on the hdd where there would be no operating system to boot to?
A: Linux liveCD could be the answer.

Recently I faced similar problem. In my case it was due to my "wise idea" of putting "/" including "/home" on the same partition, and as I went out of disk space. After reboot, ubuntu was not able to complete the process all the way up to working UI.

Please note that this is the case of unencrypted ext3 filesystem. Might not be your case.

following steps might work (as they did for me):
  • download on the other machine some livecd (livecd of ubuntu could be an option)
  • if there is empty usb key available use: pendrive linux (http://www.pendrivelinux.com/), which has really easy interface, it seems to be able to do even the download of the selected distro for you and does the job of conversion of the liveCD image to bootable usb key
  • after booting from USB on the problematic PC and having some window manager loaded (might be Unity for Ubuntu)
gksudo nautilus
if you can see the mounted filesystem there, you're lucky, just do whatever is required (possibly delete some non-critical stuff).

Otherwise (as in my case) follow the later steps:
sudo fdisk -l
this should show you all the partitions. It's important in this step to identify the one you're interested in to see the files of. You can find it based on size. As I assume you can read the output and find the important one.
In my case it was:
/dev/sdbX
now as we know the partition, let's mount important one:
sudo mkdir /media/ubuntu
sudo mount /dev/sda6 /media/ubuntu
sudo cd /media/ubuntu
now check how much is your disk occupied using:
df -h
afterwards, manipulate the files in a way you need to (possibly delete some non-critical stuff).
I used:
rm -rf /media/ubuntu/home/<user_name>/<some_dir>
And that should be it.
Happy rebooting and using the original system (if there is one) :)

And if you feel like this is too muuch technical task for you to accomplish. Just let me know that with my guidance over the skype call, my wife was able to do these steps successfully, while she's not friend of the linux cli at all.

2 comments:

Henri said...

Have you tried adding init=/bin/sh to the boot string before doing this all ? It would bring you to runlevel 1 which might be possible even with a full partition. Maybe pressing Ctrl-Alt-F1 would also have worked if the issue was only that the UI didn't load fully.

Unknown said...

thanks for ideas. No I didn't try any of these.
LiveCD was the 1.st idea comming to my mind and it seemed like the one my wife could handle with some phone support :)
well, maybe next time (although I hope for no such situation in the future)