You are on page 1of 3

Linux Diagnostics

--------------------------------------------------------------------------------
1. partitioning with fdisk

fdisk /dev/hda to partition the first hard disk


m - to get help on fdisk
p - to print/view the partition table
n - for new partition
p - for primary partition
1 - for first partition number
1 - for first cylinder of partition (default)
600 - for the ending partition number (the default is the ending partition numbe
r)
w - to write partition table to disk
2. formatting a drive with mkfs
mkfs -t ext3 /dev/hda
3. mounting a drive with mount command
mount /dev/hda /mnt/hda
4. unmounting a drive with umount command
umount /dev/hda
5. mounting the drive automatically on start-up
edit the file /etc/fstab with vi or gedit
add the following line
/dev/hda /mnt/hda ext3 defaults 1 2
6. view mountpoints with the mount command
mount
7. check space usage with the df command
df -h
8. using lynx to browse the internet on the command prompt
lynx www.ronmar.netfirms.com/ppc
9. using gpart to guess partitions if other programs can't detect correctly
gpart /dev/hda
10. using chntpw to change the administrator password for XP (assume XP drive is
/dev/hda1 mounted on /mnt/hda1)
determine if XP is mounted with ls /mnt/hda1 (if you see files, it is mounted)
unmount XP with umount /mnt/hda1
mount XP in read/write mode with mount -t ntfs-3g /dev/hda1 /mnt/hda1
(alternative) mount XP in read/write mode with mount -o rw /dev/hda1 /mnt/hda1
change to the SAM directory with cd /mnt/hda1/windows/system32/config
view contents of SAM directory with ls (you should see SAM and SECURITY)
get help on chntpw command with chntpw -h
view list of SAM users with chntpw -l SAM
change user ron's password with chntpw -u ron SAM
change administrator's password with chntpw SAM
enter * (asterisk) to blank a password
enter the new password to change the password
enter nothing to leave it unchanged
11. remote into another computer using rdesktop
on destination computer, enable remote desktop as follows:
click Start -> Control Panel -> System -> Remote Tab -> Remote Desktop -> Allow
users -> OK
find out the destination computer IP number as follows:
click Start -> Run -> cmd -> OK -> type ipconfig and record IP address (such as
198.168.10.3)
on this computer type rdesktop 198.168.10.3 (the IP address recorded above)
--------------------------------------------------------------------------------
12. using the dd command
to duplicate one hard disk partition hda1 to another hard disk partition hdb1:
dd if=/dev/hda1 of=/dev/hdb1 bs=4096 conv=notrunc,noerror
to backup an entire drive to a secondary USB drive:
dd if=/dev/hda of=/dev/sda bs=64k conv=notrunc,noerror
to restore from the USB drive back to the existing drive:
dd if=/dev/sda of=/dev/hda bs=64k conv=notrunc,noerror
to make an image of a floppy disk:
dd if=/dev/fd0 of=/temp/floppy.image
to make an iso image of a CD:
dd if=/dev/hdc of=/temp/CD.iso bs=2048 conv=sync,notrunc
to mount a CD iso image:
mkdir /mnt/CD
mount -o loop /temp/CD.iso /mnt/CD
13. what does the notrunc, noerror, and sync mean in the dd command?
Use notrunc if you don't want the output file to be deleted but the respective b
ytes in the file just "typed over".
Assume files abc that contains 10 dots and xyz that contains XYZ.
With if=xyz the file specified with of= will be overwritten without that option.
If you specify conv=notrunc just the contents at the specified location (from th
e beginning if nothing is specified) will be overwritten, and you'll get XYZ....
... (the first three dots overwritten, the remaining seven intact from the origi
nal file).
Use noerror if you have bad sectors that would normally stop the cloning process
. It continues past the bad sectors
Use sync to fill the image with nulls where it finds bad sectors.
14. how to save your changes with configsave:
To save your settings, you need to open a terminal and run the configsave comman
d with one argument the storage location and filename that ends with .mo (module
).
For example, type configsave /mnt/hda1/ronnix-server.mo to save your configurati
ons to the first partition of your first hard drive.
It will save all changed files from /root, /etc, /home and /var directories.
Note that that network settings (assigned IP address, etc) won't be saved becaus
e they are not kept in any file. If you wish to save network settings then add a
ppropriate commands to /etc/rc.d/rc.local. This file will be saved/restored, and
it's executed automatically (so your network settings will be set up).
When you are using MySlax Creator program, you can add ronnix-server.mo module t
o your list of modules and burn the CD with your changes built-in

15. how to restore your settings with configrestore


To restore your previously saved backup, use configrestore command.
For example, type configrestore /mnt/hda1/ronnix-server.mo to restore your setti
ngs
All settings found in the root folder of any of your disk partitions ( under the
name slaxconf.mo) will be restored automatically when SLAX boots.

You might also like