The following related topics are roughly in the order that one would normally utilize them.
It is important to understand that unix calls hard drives ‘devices’. Many other things besides HDDs can be ‘devices’ also. They are ussually listed as special files located at:
fdisk /dev/sda - plain text partition interface fdisk -l - list all partitions on all devices cfdisk /dev/sdb - n-curses partition interface mke2fs /dev/sdb1 - makes file system on partition sdb1 mkfs.ext3 /dev/sdb1 - ditto, does the same thing mount umount resize2fs ext2resize e2fsadm Normal order when adding a single disk: pvcreate, vgcreate, lvcreate, mkfs.ext3, mount, df
See the following page if you have problems after executing some of the above commands and run into boot problems.
sudo mkfs -V -t ntfs /dev/sdd5 ; Makes/formats the NTFS filesystem on the existing partition sdd5
To create a software raid1 or raid5, for example, they are all very similar and involve the same pre and post process. Below shows how to create a raid5 with a non-boot empty-starting one-big-filesystem setup.
cfdisk /dev/sdb cfdisk /dev/sdc cfdisk /dev/sdd
mdadm --verbose --create /dev/md0 --level=5 --raid-devices=3 --chunk=128 /dev/sd[bcd]1
mdadm -E /dev/sd[bcd]1
ls /dev/md*
cat /proc/mdstat
mkfs.ext3 -v -m .1 -b 4096 -E stride=32,stripe-width=64 /dev/md1
mkdir /media/documents
mount -t ext3 /dev/md0 /media/documents/
sudo nano -Bw /etc/fstab
#raid5 mdadm filesystem /dev/md0 /media/documents ext3 defaults 0 2
cat /proc/mdstat
tail /var/log/messages
sudo mdadm --detail /dev/md0
sudo mdadm --monitor --syslog --daemonise --test /dev/md0
sudo mdadm -E /dev/sd[abc]1
sudo /usr/share/mdadm/checkarray -h sudo /usr/share/mdadm/checkarray --status /dev/md0 sudo /usr/share/mdadm/checkarray --all --status
I had already done the create of an array from above and was moving the array to a new Ubuntu Linux machine and just needed to get it going again. Most steps are similar to the create above. Mostly the first mdadm command is different.
apt-get install mdadm
mdadm --verbose --assemble /dev/md0 /dev/sd[bcd]1
mdadm -E /dev/sd[bcd]1
ls /dev/md*
cat /proc/mdstat
mkdir /media/documents
mount -t ext3 /dev/md0 /media/documents/
sudo nano -Bw /etc/fstab
#raid5 mdadm filesystem /dev/md0 /media/documents ext3 defaults 0 2
http://tldp.org/HOWTO/LVM-HOWTO/index.html
+-- Volume Group --------------------------------+ | | | +----------------------------------------+ | | PV | PE | PE | PE | PE | PE | PE | PE | PE | | | +----------------------------------------+ | | . . . . | | . . . . | | +----------------------------------------+ | | LV | LE | LE | LE | LE | LE | LE | LE | LE | | | +----------------------------------------+ | | . . . . | | . . . . | | +----------------------------------------+ | | PV | PE | PE | PE | PE | PE | PE | PE | PE | | | +----------------------------------------+ | | | +------------------------------------------------+
pvscan ; physical volume scan, shows your hard drives df -h ; disk file structure, shows usage of filesystems; h means human readable du -hs <dir> ; disk usage of a directory; h means human readable; s means summarize, dont show sub directories dd ; device duplicate; copies or makes new files ; works with devices on block level; can copy entire disks bitwise, can make test / fake files
pvdisplay, vgdisplay, lvdisplay pvcreate, vgcreate, lvcreate pvchange, vgchange, lvchange pvremove, vgremove, lvremove pvmove, vgextend, lvextend vgreduce, lvreduce vgexport vgimport vgsplit