Wed May 23, 2012 1:32 am
Wed May 23, 2012 2:34 am
Wed May 23, 2012 10:22 am
INSTALLPARTITIONUUID=$(blkid -c /dev/null -o value -s UUID $INSTALLPARTITION)
# (rootfs)
UUID=8bc751d9-ffca-4dcd-8fd3-8c99413ac408 / ext3 relatime,errors=remount-ro 0 1
Sun May 27, 2012 2:54 pm
# setup fstab
# Option to use uuid in fstab for the installation partition, unless it's encrypted
#
## if [[ $use_uuid = yes ]]; then
## if [[ $encrypt_os = no ]]; then
## install_part="UUID=$(blkid $install_dev | awk -F"\"" '{ print $2 }')"
## fi
## fi
echo -e "\n Creating /etc/fstab...\n"
echo -e "proc\t\t/proc\tproc\tdefaults\t0\t0
/swapfile\tswap\tswap\tdefaults\t0\t0
$install_part\t/\t$fs_type_os\tdefaults,noatime\t0\t1" >> /target/etc/fstab
check_exit
# Add entry for root filesystem to crypttab if needed
if [[ $encrypt_os = yes ]] ; then
## if [[ $use_uuid = yes ]]; then
## install_dev="UUID=$(blkid $install_dev | awk -F"\"" '{ print $2 }')"
## fi
##
echo -e "\n Adding $install_part entry to crypttab...\n"
echo -e "root-fs\t\t$install_dev\t\tnone\t\tluks" >> /target/etc/crypttab
fi
Sun May 27, 2012 3:17 pm
install_dev="UUID=$(blkid $install_dev | awk -F"\"" '{ print $2 }')"
Sun May 27, 2012 4:15 pm
Sun May 27, 2012 8:47 pm
UUID= /boot ext2 defaults,noatime, 0 1
Mon May 28, 2012 12:32 am
#!/bin/bash
# script name : partlist
# udev doesn't always assign the same device node to a disk Thanks udev.
# What was once, e.g. /dev/sda3, might be /dev/sdd3 next boot
# How do you know for sure which one you want to mount ?
# Don't you just love how blkid formats it's output and screws up the columns?
#
# get the partition list
# -c /dev/null stops blkid reading a (maybe outdated) cache
# get rid of some bits we don't want
/sbin/blkid -c /dev/null|sed 's/SEC_TYPE=\"ext2\"//'g|sed 's/://'g|sed 's/"//'g|sort > /tmp/blkid
# list what has no label
while read line; do
echo -e "$line"|grep -v LABEL=|awk '{print $1}'; done < /tmp/blkid >/tmp/nolabel
# If no label the columns are out of order so insert a non-blank "LABEL=" entry
for i in $(cat /tmp/nolabel); do sed -i "s:$i:$i LABEL=\"\" :" /tmp/blkid;done
# list what is mounted
/sbin/blkid -c /dev/null -o list|grep /dev|grep -v "(not mounted)"|awk '{print $1}'>/tmp/mounted
# mark mounts with "**" in the main list
for i in $(cat /tmp/mounted); do sed -i "s:$i:$i\**:" /tmp/blkid;done
# append a footnote to explain **
echo "** ** ** **">> /tmp/blkid
echo "**=MOUNTED">> /tmp/blkid
# tidy it up into nice columns
column -t /tmp/blkid >/tmp/partlist
# delete the crap
rm -f /tmp/blkid /tmp/mounted /tmp/nolabel
# display the result
xterm -geometry 95x30 -e "less /tmp/partlist"
Mon May 28, 2012 12:04 pm
Mon May 28, 2012 12:08 pm
blkid | awk '{ print $2 }'
blkid /dev/sda1 |cut -d" " -f2
/dev/sda3: UUID="95395ac9-84e3-4498-99e5-d7d1460953e1" TYPE="crypto_LUKS"
/dev/sda2: UUID="8adab59e-164f-41a4-a470-d34e25a652a4" TYPE="ext4"
/dev/mapper/home-fs: UUID="290334be-fb0c-4d38-83d3-a27402fa6671" TYPE="ext4"
/dev/sda1: UUID="f73778a0-2378-457b-8be7-74c2c7ef782c" TYPE="ext2" LABEL="bootpart"