Here is a quick matrix sheet to help you quickly find out the commands for disks, filesystems, and devices on different Unix/Linux distros

 

 
Solaris
Red Hat
Ubuntu/Debian
HP
AIX
Disk Drives

format
prtvtoc <device>
cfgadm -al
fcinfo hba-port
luxadm probe
mpathadm list initiator-port
mpathadm show <initiator-port name>
iscsiadm list initiator-node
iscsiadm list discovery

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>

udevadm info -q all -n /dev/sda1
blkid
dmsetup [ls|info]

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

scsi_id

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

parted

 

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 info

## 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

 

Bad Blocks format (use analyse ) badblocks badblocks dd if=/dev/rdsk/cXtYd0 of=/dev/null bs=1024K

Note: no errors means disk is good
chlv -b [y|n] <lv>

Note: enables bad block relocation
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
mke2fs -t ext4 /dev/sdb1

# all point to mke2fs
mkfs.ext2
mkfs.ext3
mkfs.ext4

cat /etc/mke2fs.conf

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
fsck.mode=force (kernel parameter)


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
mount/umount ISO image

lofiadm -a <iso image> /dev/lofi/1
mount -F hsfs -o ro /dev/lofi/1 /mnt

# to list
lofiadm

       
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 single to the kernel line using the grub window append the word single to 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)