3 in1 Disk Monitring / Add new Swap / boot system without any physical media
Disk Monitring with SMART
Many system administrators don’t know that Self-Monitoring, Analysis and Reporting Technology systems (SMART) are built in to most modern ATA and SCSI hard disks.
[root@power root]# fdisk -l
Disk /dev/sda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 \* 512 = 8225280 bytes
Disk identifier: 0x3f443f43
Device Boot Start End Blocks Id System
/dev/sda1 \* 1 1276 10243768+ c W95 FAT32 (LBA)
Partition 1 does not end on cylinder boundary.
/dev/sda2 1277 6246 39921525 83 Linux
/dev/sda3 6247 6376 1044225 82 Linux swap / Solaris
Output of disk information
===========================
[root@power root]# smartctl -i /dev/sda
smartctl version 5.38 [i386-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF INFORMATION SECTION ===
Device Model: ST960812A
Serial Number: 5PJ1KKV4
Firmware Version: 3.05
User Capacity: 60,011,642,880 bytes
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: 6
ATA Standard is: ATA/ATAPI-6 T13 1410D revision 2
Local Time is: Sun Dec 13 22:51:17 2009 PKT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
To check the disk Health
=========================
[root@power root]# smartctl -Hc /dev/sda
smartctl version 5.38 [i386-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: FAILED!
Drive failure expected in less than 24 hours. SAVE ALL DATA.
Failed Attributes:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
5 Reallocated_Sector_Ct 0x0033 001 001 036 Pre-fail Always FAILING_NOW 39184
Ohh God my drive shows the error Disk Failure. I have to replace the drive :(
The most important part to see the disk error
[root@power root]# smartctl -l error /dev/sda
smartctl version 5.38 [i386-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF READ SMART DATA SECTION ===
SMART Error Log Version: 1
No Errors Logged
Disk Self test
[root@power root]# smartctl -t short /dev/sda
smartctl version 5.38 [i386-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: “Execute SMART Short self-test routine immediately in off-line mode”.
Drive command “Execute SMART Short self-test routine immediately in off-line mode” successful.
Testing has begun.
Please wait 1 minutes for test to complete.
Test will complete after Sun Dec 13 22:57:28 2009
Use smartctl -X to abort test.
[root@power root]#
Create/Add New SWAP
Disk /dev/cciss/c0d0: 440.3 GB, 440345714688 bytes
255 heads, 63 sectors/track, 53535 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 13 104391 83 Linux
/dev/cciss/c0d0p2 14 2563 20482875 83 Linux
/dev/cciss/c0d0p4 4094 53535 397142865 5 Extended
/dev/cciss/c0d0p5 4094 53535 397142833+ 83 Linux
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
p
Selected partition 3
First cylinder (2564-53535, default 2564):
Using default value 2564
Last cylinder or +size or +sizeM or +sizeK (2564-4093, default 4093): +3G
Command (m for help): t
Partition number (1-5): 3
Hex code (type L to list codes): L
0 Empty 1e Hidden W95 FAT1 80 Old Minix be Solaris boot
1 FAT12 24 NEC DOS 81 Minix / old Lin bf Solaris
2 XENIX root 39 Plan 9 82 Linux swap / So c1 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
5 Extended 41 PPC PReP Boot 85 Linux extended c7 Syrinx
6 FAT16 42 SFS 86 NTFS volume set da Non-FS data
7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set db CP/M / CTOS / .
8 AIX 4e QNX4.x 2nd part 88 Linux plaintext de Dell Utility
9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM df BootIt
a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e1 DOS access
b W95 FAT32 51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O
c W95 FAT32 (LBA) 52 CP/M 9f BSD/OS e4 SpeedStor
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi eb BeOS fs
f W95 Ext’d (LBA) 54 OnTrackDM6 a5 FreeBSD ee EFI GPT
10 OPUS 55 EZ-Drive a6 OpenBSD ef EFI (FAT-12/16/
11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP f0 Linux/PA-RISC b
12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f1 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor a9 NetBSD f4 SpeedStor
16 Hidden FAT16 63 GNU HURD or Sys ab Darwin boot f2 DOS secondary
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fd Linux raid auto
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fe LANstep
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid ff BBT
1c Hidden W95 FAT3 75 PC/IX
Hex code (type L to list codes): 82
Changed system type of partition 3 to 82 (Linux swap / Solaris)
root@oratech ~]# mkswap /dev/cciss/c0d0p3
Setting up swapspace version 1, size = 3010445 kB
[root@oratech ~]# swapon /dev/cciss/c0d0p3
swapon: /dev/cciss/c0d0p3: Device or resource busy
[root@oratech ~]#
[root@oratech ~]#
[root@oratech ~]# swapoff /dev/cciss/c0d0p3
[root@oratech ~]# mkswap /dev/cciss/c0d0p3
Setting up swapspace version 1, size = 3010445 kB
[root@oratech ~]# swapon /dev/cciss/c0d0p3
[root@oratech ~]# free -m
total used free shared buffers cached
Mem: 3289 475 2813 0 76 325
-/+ buffers/cache: 73 3215
Swap: 2870 0 2870
To boot system with with out cdrom, network or any booting device. Just copy the ISO image on your linux server and perform the following steps.
[root@power ~]# mkdir /mnt/tmp
mount Iso image.
[root@power ~]# mount -o loop /data/fc4/FC4-i386-disc1.iso /mnt/tmp
[root@power ~]# mkdir /boot/mylinux
cp /mnt/tmp/isolinux/vmlinuz /boot/mylinux
cp /mnt/tmp/isolinux/initrd.img /boot/mylinux/initrdMy.img
then add following lines to /etc/grub.conf
title Fedora Core 4 Installer
root (hd0,0) «———— boot partition
kernel /mylinux/vmlinuzMy
initrd /mylinux/initrdMy.img