Wednesday, June 10, 2009

Format and Mounting New Hard disk on Linux


Ckckckckckckck.....
Installation new harddisk broo..........
ckckckc..........
i cant guess that i must install new harddisk, because today i've run out of My disk space damn !!
ckckckckck
ok ...
let's see....(here i use UBUNTU 8.10 )

command line mode : ON


$ df -H (for see space of disk broo...)
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 19G 16.8G 2.2G 89% /
tmpfs 127M 0 127M 0% /lib/init/rw
varrun 127M 103k 127M 1% /var/run
varlock 127M 0 127M 0% /var/lock
udev 127M 2.8M 124M 3% /dev
tmpfs 127M 0 127M 0% /dev/shm
lrm 127M 2.1M 125M 2% /lib/modules/2.6.27-7-generic/volatile

$ su - root (become root ya...accidental hard drive already installed so there isn't need turn off the computer hehehe..... i use hardisk maxtor IDE 160gb)
password:******(usual enter root password)

# fdisk -l (to see my hard drive already signed or have not)
Disk /dev/sda: 20.0 GB, 20020396032 bytes
255 heads, 63 sectors/track, 2434 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x473432c2

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2327 18691596 83 Linux
/dev/sda2 2328 2434 859477+ 5 Extended
/dev/sda5 2328 2434 859446 82 Linux swap / Solaris

Disk /dev/sdb: 160.0 GB, 160000000000 bytes
255 heads, 63 sectors/track, 19452 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table
(wah already signed but cos of new harddrive you will see like that ya.....)

# fdisk /dev/sdb (this for create partition on your new hard drive....)
The number of cylinders for this disk is set to 2434.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): m (press m for help)
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): n
( n for new partition ok! than press enter 2 times ok..... finish now we have new partition .........)

# fdisk -l
Disk /dev/sda: 20.0 GB, 20020396032 bytes
255 heads, 63 sectors/track, 2434 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x473432c2

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2327 18691596 83 Linux
/dev/sda2 2328 2434 859477+ 5 Extended
/dev/sda5 2328 2434 859446 82 Linux swap / Solaris

Disk /dev/sdb: 160.0 GB, 160000000000 bytes
255 heads, 63 sectors/track, 19452 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 19452 18691596 83 Linux
(already signed new partition hehehehehe ...... next broo)

# mkfs.ext3 /dev/sdb1 (format hardisk till finish using type ext3 (not NTFS windows ya)

# mkdir /mnt/disk-2 (create new folder to new mount disk hihiihihihi delight :) )

# mount -t ext3 /dev/sdb1 /mnt/disk-2 (mount new disk so that could be used.... hehehehe)

# df -H (check again brooo.....)
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 19G 16.8G 2.2G 89% /
tmpfs 127M 0 127M 0% /lib/init/rw
varrun 127M 103k 127M 1% /var/run
varlock 127M 0 127M 0% /var/lock
udev 127M 2.8M 124M 3% /dev
tmpfs 127M 0 127M 0% /dev/shm
lrm 127M 2.1M 125M 2% /lib/modules/2.6.27-7-generic/volatile
/dev/sdb1 160G 0 160G 100% /mnt/disk-2 (already enter broo....)

# vi /etc/fstab (to create permanent disk so don't have to be mounted again when you restart your computer)

# /etc/fstab: static file system information.
proc /proc proc defaults 0 0
/dev/sda1 / ext3 relatime,errors=remount-ro 0 1
/dev/sda5 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
(tambahin dimari boss)
/dev/sdb1 /mnt/disk-2 ext3 defaults 1 3
(terus tekan ESC dan ketik :wq! untuk simpan ok.....selesai bozzz.......)


Alhamdulillah i have done......

No comments: