31 Mayıs 2012 Perşembe

Unix komutları -3


Disks, Filesystems and Devices commands


Solaris
Red Hat
Ubuntu/Debian
HP
AIX
Disk Drives
format
prtvtoc <device>
format -e (to convert EFI (zfs) to SMI)
Note:
EFI - Extensible Firmware Interface
SMI - Sun Microsystems Inc
fdisk -l
sfdisk -l (advanced server)
parted <device> print
partprobe <device>
fdisk -l
sfdisk -l (advanced server)
parted <device> print
partprobe <device>
ioscan -funC disk
lsdev -Cc disk
lsdev -Cc disk -p scsi0 (specific controller)
lsdev -Cc disk -S [a|d|s] (available, defined,stopped)

lscfg -v -l hdisk0
Disk serial Number, type, etc
format
iostat -En
luxadm inq <disk> (A5x00 disk arrays)
hdparm -i /dev/hda
hdparm -I /dev/hda (detailed)

hdparm -Tt /dev/hda (speed test)

sdparm -i /dev/sdb
 

cat /proc/ide/ide0/hda/model
cat /proc/scsi/scsi
hdparm -i /dev/hda
hdparm -I /dev/hda (detailed)

haparm -Tt /dev/hda (speed test)

sdparm -i /dev/sdb
 

cat /proc/ide/ide0/hda/model
cat /proc/scsi/scsi
diskinfo -v /dev/rdsk/c0t4d0 (detailed but no serial number)
/opt/ignite/bin/print_manifest (no serial number)
## Insure that the online diagnostic support tools have been installed
swlist -l bundle | grep 'Support Tools'
## Command-Line Support Tools Manager (cstm) 
## The run cstm
 
cstm
cstm> map
cstm> sel dev 4       (select the disk of you choice)
cstm> info
cstm> il                  (obtain the serial number)
 
cstm> quit
 
lscfg -vl hdisk0
lscfg -vl hdisk*
Disk disk partitions
prtvtoc <device>

cat /etc/vfstab
fdisk -l
sfdisk -l (advanced server)
cat /proc/partitions (very high level)
cat /etc/fstab

fdisk -l
sfdisk -l (advanced server)
cat /proc/partitions (very high level)
cat /etc/fstab
lvlnboot -v /dev/vg00 
lifls -Clv <device>

# Display the LIF contents
lifcp /dev/dsk/c0t6d0:AUTO -
 

cat /etc/fstab
Note: Boot programs are stored in the boot area in Logical Interchange Format (LIF), which is similar to a file system. For a device to be bootable, the LIF volume on that device must contain at least the ISL
(the initial system loader) and HPUX (the HP-UX bootstrap utility) LIF files. ISL is like GRUB.
lsvg -l rootvg 
lchangelv
cat /etc/filesystems
List Raw Partitions
use format to partition the disk then just use the slice as a raw partition, remember to use the character device
## Old way 
/etc/sysconfig/rawdevices
service rawdevices start
chkconfig rawdevices on
## New way, Edit below file 
/etc/udev/rules.d/60-raw.rules
udevinfo -d or udevadm
 

## Display raw partitions
 
raw -qa
mknod /dev/rawctl c 162 0
mknod /dev/raw/raw0 c 162 1
mknod /dev/raw/raw1 c 162 2
ln -s /dev/rawctl /dev/raw/rawctl

## map raw devices to the disk
raw /dev/raw/raw1 /dev/sdb1

## display raw devices
raw -qa
Just create a new LVOL without a filesystem - that's it.
Just create a new LVOL without a filesystem
# create a raw volume
mklv -y rawVolume vg01 10

Filesystem commands
df -k
df -h
 
df -k 
df -h
df -k
df -h
bdf
df [-egiklnvfb]
df -k 
lsfs [<filesystem>]
 
lsfs -q <filesystem> (detailed)
 
Filesystem (create|remove)
newfs -v <raw device>

# Display how the filesystem was created
 
newfs -Nv <filesystem>
mkfs -t ext3 /dev/sdb1
mkfs -t ext3 /dev/sdb1
newfs -F vxfs -o largefiles /dev/vg01/rlvol1

mkfs -F vxfs -o largefiles /dev/vg01/rlvol1

Note: mkfs and newfs are a pointer to /sbin/fs_wrapper
 
crfs -v jfs2 -d data02lv -m /data02 -A yes

-v filesystem type
-d device or logical volume
-m mountpoint
-A mount after restart [yes|no]

rmfs -ri /data02

-r remove the mountpoint
-i display warning before removing
chfs -a size=+1G /var (grow by additional 1GB) 
chfs -a size=1G /var (grow to 1GB in size)
Tune Filesystems
tunefs
fstyp -v <device> |grep -i minfree
tune2fs
tune2fs -l /dev/sda1
# change reserved blocks percentage to 1%
tune2fs -m 1 /dev/sda1
tune2fs
tune2fs -l /dev/sda1
# change reserved blocks percentage to 1%
tune2fs -m 1 /dev/sda1
tunefs -v <filesystem>
vxtunefs -v <filesystem>
 
fstyp -v <filesystem>

# Disk fragmentation
fsadm -F vxfs -E / (report)
fsadm -F vxfs -e / (defrag)
chfs

Note: you can perform the following
resize
freeze
change mountpoint
permissions
lots more..............................
Force fsck




# Check to see filesystem needs checking
fstyp -v <filesystem> | grep fsclean
touch /forcefsck
shutdown -Fr now


tune2fs -l /dev/sdb<?> |grep -i 'filesystem state'
touch /forcefsck
shutdown -r now


tune2fs -l /dev/sdb<?> |grep -i 'filesystem state'
 

# edit /etc/default/rcS change below so
 
# you dont have to hang around
 
FSCKFIX=yes


# Look at the second line to see if a filesystem 
# needs checking
 
tunefs -v <filesystem>
n/a
backup filesystem
ufsdump|ufsrestore
tar
dd
cpio
dump/restore
tar
dd
cpio
dump/restore
tar
dd
cpio
fbackup/frecover
dump/restore
ftio
 
tar
dd
cpio
backup|restore
tar
dd
cpio
Display the boot device
eeprom |grep boot-device 
prtconf -pv |grep bootpath
 
prtpicl -v|grep ':bootpath'
cat /boot/grub/grub.conf
cat /etc/lilo.conf
grub = grand unified boot loader
lilo = linux loader
cat /boot/grub/menu.lst
setboot
bootinfo -b (display last boot device) 
bootlist -m [normal|service] -o (display bootable devices)
Setting the boot device
setenv boot-device [<device>|<alias>]
eeprom boot-device [<device>|<alias>]
/boot/grub/grub.conf
/etc/lilo.conf

/boot/grub/menu.lst
setboot -p <primary path>
setboot -a <alternate path>

# autoboot sequnce
 
setboot -b [on|off]
bootlist -m normal hdisk0 hdisk1
Creating boot device (MBR)
installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk <raw-device>
grub-install <raw-device> 
lilo -v
grub-install <raw-device>
mkboot -l <device>

Note: we are treating the disk as a LVM device
bosboot -a (uses default device)
bosboot -ad hdisk1
Format floppy drive
fdformat -v -U
volcheck -v
newfs -v /vol/disk/aliases/floppy0
floppy --probe (use device obtained below ) 
floppy --createrc > /etc/fd0
floppy --format /dev/fd0
mkfs /dev/fd0
n/a
n/a
format -d /dev/rfd0
format -d /dev/fd0.18 (high format)
mount/unmount floppy
volrmmount -l floppy0
eject floppy
mount /dev/fd0 /mnt/floppy
umount /mnt/floppy
n/a
n/a
mount /dev/rfd0 /floppy
mount/unmount CDROM
mount -F hsfs -o ro <device path> /cdrom/cdrom0
umount /cdrom/cdrom0

/etc/init.d/volmgr start
eject cdrom
mount -rt iso9660 /dev/cdrom /mnt/cdrom
umount /mnt/cdrom
eject cdrom
mount -rt iso9660 /dev/cdrom /mnt/cdrom
umount /mnt/cdrom
eject cdrom
mount -rF cdfs /dev/dsk/c1t6d0 /cdrom
start: /usr/sbin/pps_mountd
pps_mount
mount -v cdrfs -r /dev/cd0 /cdrom
umount /cdrom
remount a filesystem
n/a
mount -o remount,rw /
mount -o remount,rw /
mount_vxfs -o remount,ro <filesystem>
mount -o remount,rw <filesystem>
Note:I did find a note that it should be possible to remount a jfs2 filesystem, but it did not work on my system
create boot disk or recovery tape
n/a
mkbootdisk `uname -r` (boot diskette)
n/a
recovery tape (preview)
make_tape_recovery -v -l -x inc_entire=vg00
/opt/ignite/bin/make_recovery -ACv
mksysb
boot cdrom/diskette (single user)
ok> boot cdrom -s
using the grub window append the word singleto the kernel line
using the grub window append the word singleto the kernel line
enter PDC
> search
 
>boot p1 (cdrom)
 
interact with IPL? Y
ISL> hpux -is
based on a 9114-275 workstation
1.     Restart the machine.
2.     Wait the the AIX splash screen to come up. Devices begin to initialize here.
3.     When you see the [keyboard] word on screen hit the F5 button or the 5 key depending on your console.
4.     Choose “default boot list ” when the maintenance screen comes up.
boot into maintenace mode
ok> boot -as
f10 or f12
f10 or f12
>boot pri 
interact with IPL? Y
ISL> hpux -lm
based on a 9114-275 workstation
1.     Restart the machine.
2.     Wait the the AIX splash screen to come up. Devices begin to initialize here.
3.     When you see the [keyboard] word on screen hit the F5 button or the 5 key depending on your console.
4.     Choose “select boot options ” when the maintenance screen comes up, then option 1, then option 1 for scsi, then option 3 service mode boot
Device paths
floppy:
disk:
/dev/dsk/c0t0d0s0

tape:
/dev/rmt/0ucb

cdrom:
/dev/dsk/c0t6d0s0
/dev/scd0 (external usb cd)
floppy:
/dev/fd0
disk:
/dev/hda or /dev/sda
 
/dev/hdb or /dev/sdb
tape:
cdrom:
/dev/hda (depends on number of IDE disks)
floppy:
/dev/fd0
disk:
/dev/hda or /dev/sda
 
/dev/hdb or /dev/sdb
tape:
cdrom:
/dev/hda (depends on number of IDE disks)
floppy:
n/a
disk:
/dev/dsk/c0t6d0
tape:
/dev/dsk/rmt/0
cdrom:
/dev/dsk/c1t6d0
floppy:
/dev/fd0
/dev/rfd0
disk:
/dev/hdisk0
tape:
cdrom:
/dev/cd0
update /dev directory
drvconfig
devlinks
disks|tapes|ports

devfsadm ( solaris 8, 9, 10)
/dev/MAKEDEV <device>
/dev/MAKEDEV <device>
insf -C tape (Class)
insf -H 0.1.0 -e (recreate deleted link)
cfgmgr
cfgmgr -l scsi0
mkdev
remove or change a device
rem_drv


# remove all devices from a hardward path 
rmsf -k -H 52.6.0
rmdev
rmdev -l cd0

chdev
chdev -l rmt0 -a ret=no
list device drivers
prtconf -D 
sysdef
cat /proc/devices
cat /proc/devices
lsdev
lsdev
lsdev -Cc disk
lsdev -Cc disk -p scsi0
lsslot -c pci -l ent0

lscfg
lscfg -l ent0
lscfg -vl fcs0 (find the WWN of HBA adapter)

lspath -l hdisk0
 

getconf DISK_SIZE hdisk1 (detailed)

1 yorum:

  1. I was recommended this website by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my trouble.
    You're amazing! Thanks!
    Also see my website :: Recovery for exchange server

    YanıtlaSil