Anything can go here, in any language... except my native language Sinhala. Be cool... anybody is warmly welcomed! :)

Disk Maintenance with Ubuntu Live


Well, I thought of writing about some disk management which you can do with just using an Ubuntu Live CD.

First thing is, we don't need the GUI. Forget it. The text mode works considerably faster. After loading the initial screen of the Ubuntu Live CD, select the language, then press F6. You get a line that can be edited, and ends with the following parameters:

initrd=/casper/initrd.gz quiet splash --

Replace quiet splash with this:

ro single

And press Enter. Now the system boots into the single user mode. In other words, you are taken into the text mode. In later versions of Ubuntu, you get a menu. Just select root and you'll become root user! You can backup your disks, partition disks, file system check and many more!

Partitioning disks:
Just use either parted or fdisk. Personally I would prefer fdisk.
# fdisk -l (to list all filesystems)
# fdisk /dev/sda (to partition the first disk which is SCSI)
# parted /dev/sda (to partition the first disk which is SCSI)

Dont panic! Help is provided inside these commands. You just need to know plain English and the way that a partition table is structured (theory). :)

Format disks:
# mke2fs /dev/sda1 (format the partition as ext-2)
# mke2fs -j /dev/sda1 (format the partition as ext-3)
# mkntfs /dev/sda1 (format the partition as ntfs)
# mkdosfs /dev/sda1 (format the partition as FAT12/ FAT16 or FAT32)
# mkswap (format as swap)

Filesystem check:
# fsck /dev/sda1 (check and repair Linux filesystem on the drive, the partition should be unmounted first!!!)
# dosfsck /dev/sda1 (check FAT12/16/32 filesystem)

Tune Filesystem:
# tune2fs /dev/sda1 (tune adjustable parameters on a Linux filesystem)
Linux filesystems are periodically checked for  consistency during boot. You can adjust that time period with this tool.
# tune2fs -c 60 /dev/sda1 (set fsck to be executed on /dev/sda1 once a two months)

Backup your data into another drive:
Just execute the following commands one by one. Please refer this thread for a broader discussion.
# mkdir /source
# mount /dev/sda1 /source; mount /dev/sdb1 /mnt
# cd /mnt
# tar cvpzf backup.tgz --exclude=/source/lost+found --exclude=/mnt /source

To restore later (assume the backup archive is located at /dev/sdb1),
# mkdir /mnt/backup /mnt/restore
# mount /dev/sda1 /mnt/restore; mount /dev/sdb1 /mnt/backup
# cd /backup
# tar xvpfz backup.tgz -C /restore

Repair GRUB bootloader:
I got to know about this from here. Not everybody can access that site, so I'll put the whole thing here. Enter the following commands one by one.
# grub
/find/grub/stage1 (find the corresponding values for x and y for the next step)
root(hdx,y)
setup(hdx)

Execute binaries on an existing Linux installation:
# mount /dev/sda1 /mnt; chroot /mnt
You can change the root password too!!! :-O

Wanna see how NTFS is supported on Ubuntu?
Just type ntfs at the root shell prompt and press the Tab twice. I'm not gonna put it here.

If you think I might have forgotten anything to put here, don't hesitate to share it here... Thanks for reading!

Comments (2)

chathuraw

September 29, 2009 at 4:28 PM

Nice... Very useful...

ශාකුන්තල

September 29, 2009 at 4:35 PM

Thank you! :)

Followers

Subscription Options

 Subscribe in a reader

or

Enter your email address:

and
to inscrease

and make me happy. :)

Other Blogs by the Author

The Author

My photo
Ambalangoda, Southern Province, Sri Lanka
Shaakunthala works as a Systems Support Engineer at a World's leading IT solutions company. A wannabe hacker, FOSS enthusiast, cat lover and an insane motorcyclist. And he comes from Sri Lanka!! :)

www.shaakunthala.com
www.flickr.com
ශාකුන්තල | Shaakunthala's items Go to ශාකුන්තල | Shaakunthala's photostream
Related Posts with Thumbnails