Showing posts with label ext3. Show all posts
Showing posts with label ext3. Show all posts

Tuesday, September 1, 2009

Adding a new disk to a Linux Fedora machine

as root:
fdisk -l to find the new disk.

You'll get something like this:

Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000a121f

Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 1044 8185117+ 8e Linux LVM

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table


So the new disk is /dev/sdb

To create a new partition:
fdisk /dev/sdb
n (new partition)
p (primary partition)
1 (partition 1)
hit enter (first cylinder)
hit enter (last cylinder)
w (write changes and quit)

now check the new status with
fdisk -l

and now you'll get something like this:

Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000a121f

Device Boot Start End Blocks Id System
/dev/sda1 * 1 25 200781 83 Linux
/dev/sda2 26 1044 8185117+ 8e Linux LVM

Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x6fad050b

Device Boot Start End Blocks Id System
/dev/sdb1 1 1044 8385898+ 83 Linux

Now format the new partition
mkfs.ext3 /dev/sdb1

Create a new folder to mount the new partition:
mkdir /disk2

and edit /etc/fstab to mount it after the next reboot adding this line
/dev/sdb1 /disk2 ext3 defaults 1 2

then reboot

Monday, March 23, 2009

How to extend Lifetime of a degrading Hard Disk

If one of your hard disks is physically degrading, you can extend its lifetime (while you backup data and prepare to replace the disk) by marking bad blocks and preventing from attempting to store data on them. Assuming an unmounted, ext3 filesystem on /dev/sda1, you can use the following command to perform a non-destructive check for physical failures and then store them in a special inode that the operating system knows to avoid using:

~ e2fsck -cc /dev/sda1

You could also use the badblocks command by its self to write a list of bad blocks to a file and read it into e2fsck with the -l option later.