A Question On Blkid

Hi,

On fedora20, when I execute the blkid -L command I receive the following message:
Quote:
blkid: option requires an argument -- 'L'
blkid from util-linux 2.24.2 (libblkid 2.24.0, 24-Apr-2014)
Usage:
blkid -L <label> | -U <uuid>
...
But I have seen that people have an output like the image as enclosed.

Please let me know How I can fix blkid -L to show a similar result for me.


Similar Content



Problems After Cloning VM To Physical HD

I just cloned a Centos7 "everything install" VM to a physical disk using VMWare Workstation and Clonezilla using the instructions he https://www.howtoforge.com/convertin...cal-machine-p2

Now, when the clone (physical disk) boots up, it drops into the command line with this:

Quote:
dracut-initqueue[417]: Warning: Could not boot.
dracut-initqueue[417]: Warning: /dev/disk/by-uuid/4b8b5627-9027-46f7-b722-61d3ddd28e74 does not exist Starting dracut emergency shell...
What I've tried:
1. I checked /etc/fstab and the proper UUIDs are there, including the one above.
2. Tried booting via USB stick installer into rescue mode, chroot /mnt/sysimage , and:

Quote:
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-oh_crud.img
and then
Quote:
dracut /boot/initramfs-$(uname -r).img $(uname -r)
...but I get this:

Quote:
cat: write error: Broken pipe
When I enter "blkid", I see the HD in question showing up as both /dev/block... and /dev/sdb... I tried "lshw -class disk" but it says "command not found". Finally, the rescue shell says it is mounting my disk in /mnt/sysimage and all my files are where they should be, so it appears it is seeing and mounting the HD.

Any suggestions? I am a n00b, so going off a lot of google and not a lot of understanding here.

Help Mounting A CD-R/DVD-R, Then Using Dd To Write To Them.

I can't seem to mount a CD-R or DVD-R, doesn't matter if it is blank or not.
However, when I use a program such as Brasero, I am able to write to them. I cannot use dd to write to them.

This is the output of trying to mount/unmount.
Code:
root@delarocha-> mount /dev/sr0 /media/cd
mount: /dev/sr0 is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/sr0,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail or so.

root@delarocha-> umount /dev/sr0
umount: /dev/sr0: not mounted
root@delarocha-> umount /media/cd
umount: /media/cd: not mounted
root@delarocha-> umount /media/cdrom
umount: /media/cdrom: not mounted

dmesg | tail
Code:
root@delarocha-> dmesg | tail
[ 1536.299777] sr 1:0:0:0: [sr0]  
[ 1536.299804] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 1536.299809] sr 1:0:0:0: [sr0]  
[ 1536.299814] Sense Key : Illegal Request [current] 
[ 1536.299820] sr 1:0:0:0: [sr0]  
[ 1536.299824] Add. Sense: Logical block address out of range
[ 1536.299829] sr 1:0:0:0: [sr0] CDB: 
[ 1536.299832] Read(10): 28 00 00 00 00 00 00 00 01 00
[ 1536.299846] end_request: I/O error, dev sr0, sector 0
[ 1536.299915] EXT4-fs (sr0): unable to read superblock

I don't think it can be anything wrong with the disk, since it is a untouched disk.
Note: The results of everything(apart from dmesg I would assume), are the same for a CD-R and DVD-R

This is what I get while trying to dd a .iso and .mp4, respectively.

Code:
web@delarocha-> dd if=/dev/sr0 of=~/Downloads/xubuntu-14.04.1-desktop-amd64.iso
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000377316 s, 0.0 kB/s

Code:
web@delarocha-> dd if=/dev/sr0 of=~/Videos/The\ Hobbit/The\ Hobbit\ The\ Desolation\ of\ Smaug.mp4
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000377179 s, 0.0 kB/s

uname -a
Code:
Linux delarocha 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt2-1 (2014-12-08) x86_64 GNU/Linux

When I used lsblk when I close the disk tray, it shows it mounted.
Code:
sr0                     11:0    1     2K  0 rom

But after I use the dd command to write the .iso, it disappears.

Here is my /etc/fstab
Code:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/delarocha-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda1 during installation
UUID=5bbedec0-6e3d-4185-91e0-292a72585908 /boot           ext2    defaults        0       2
/dev/mapper/delarocha-swap_1 none            swap    sw              0       0
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/sdb1       /media/usb0     auto    rw,user,noauto  0       0

I have also tried replacing /dev/sr0 in the above commands with /media/cdrom0.

Executing Command From File (with Tail) Probably Misquotes?

When working with a virtual terminal, I find it often easier to edit a file to execute than to construct a regular-expression etc. to inject the right UUID etc. into the command. I have run into an error while doing this. I suspect it is stems from quote mishandling, or improper escape sequences. (I ran directly from the command line earlier, forgot a quotation mark, and it gave a similar bad result.)
The program in question was efibootmgr. I had a file vaguely similar to this one, named efiboot.Hz:
Code:
efibootmgr -c -g -L "Debian (EFI stub)" -l '\EFI\debian\vmlinuz' -u 'root=UUID=$UUID ro quiet rootfstype=ext4 add_efi_memmap initrd=\\EFI\\debian\\initrd.img'
efibootmgr -c -d /dev/sdb -L "Debian Linux" -l '\EFI\debian\vmlinuz' -u 'root=UUID=1234-ffff-789 ro quiet rootfstype=ext4 add_efi_memmap initrd=\\EFI\\debian\\initrd.img'

Then I executed:
Code:
`tail -n 1 efiboot.Hz`

efibootmgr -v revealed the previous command produced a garbled name and boot options, and most importantly it didn't boot. Manually writing the last line on the terminal did produce the desired effect. I thought I checked the output from tail before putting the back-ticks.
What did I do wrong?

Problems With Mounting Drive At Boot

Hi,

I have problems mounting my second drive at boot automatically.
(sorry i am a noob)

When i use the mount command, it works fine.
Code:
mount -t ext3 /dev/sdb2 /mnt/HD/HD_b2

But when i try to add one if the following lines to /etc/fstab
It will not mount the drive at boot or with Code:
mount -a

, also fstab is empty afer reboot (normal??)

Code:
/dev/sdb2 /mnt/HD/HD_b2 ext3 defaults,errors=remount-ro 0 1

Code:
UUID=553afede-fa45-4cdc-9972-c0a9aa899509 /mnt/HD/HD_b2 ext3 errors=remount-ro 0 1

Code:
/dev/sdb2 /mnt/HD/HD_b2 ext3 rw 0 0

Code:
/dev/sdb2 /mnt/HD/HD_b2 ext3 defaults 0 1

output blkid:

Code:
/dev/sda1: UUID="e67e5c15-7b8b-9389-c311-e5d4c61326f9" TYPE="linux_raid_member"
/dev/sda2: UUID="09e0e365-0aa6-4214-b571-2bc6b027fd9f" TYPE="ext3"
/dev/sda4: UUID="64038414-136c-4939-bd14-9871a20290bd" TYPE="ext3"
/dev/sdb1: UUID="e67e5c15-7b8b-9389-c311-e5d4c61326f9" TYPE="linux_raid_member"
/dev/sdb2: UUID="553afede-fa45-4cdc-9972-c0a9aa899509" TYPE="ext3"
/dev/sdb4: UUID="bf594be6-ffb6-469d-a3a8-246be66a4d90" TYPE="ext2"

/etc/mtab:

Code:
rootfs / rootfs rw 0 0
/dev/root / ext2 rw,relatime,errors=continue 0 0
sysfs /sys sysfs rw,relatime 0 0
proc /proc proc rw,relatime 0 0
squash /usr/local/tmp ramfs rw,relatime,size=38m 0 0
/dev/loop0 /usr/local/modules squashfs ro,relatime 0 0
/dev/mtdblock5 /usr/local/config jffs2 rw,relatime 0 0
/dev/sda4 /mnt/HD_a4 ext3 rw,relatime,errors=continue,data=writeback 0 0
/dev/sdb4 /mnt/HD_b4 ext2 rw,relatime,errors=continue 0 0
none /proc/bus/usb usbfs rw,relatime 0 0
/dev/sda2 /mnt/HD/HD_a2 ext3 rw,relatime,errors=continue,user_xattr,data=writeb$
/dev/sdb2 /mnt/HD/HD_b2 ext3 rw,relatime,errors=continue,user_xattr,data=writeb$
/dev/sda2 /mnt/HD/HD_a2/squeeze/mnt/HD/HD_a2 ext3 rw,relatime,errors=continue,u$
/dev/root /mnt/HD/HD_a2/squeeze/mnt/root ext2 rw,relatime,errors=continue 0 0
/dev/root /mnt/HD/HD_a2/squeeze/dev ext2 rw,relatime,errors=continue 0 0
sysfs /mnt/HD/HD_a2/squeeze/sys sysfs rw,relatime 0 0
proc /mnt/HD/HD_a2/squeeze/proc proc rw,relatime 0 0

When mount command is used Code:
mount -t ext3 /dev/sdb2 /mnt/HD/HD_b2

The following line is added to mstab -->
Code:
/dev/sdb2 /mnt/HD/HD_b2 ext3 rw 0 0

I diont know what i am doing wrong, mount for HD_a2 works fine (other disk, worked at default), i hav e NAS DNS-325 where i installed Debian on. I used this tutorial to install debian.

The strange thing is, i had to reinstall my NAS, and befor it worked fine after i had installed debian 2 years ago, i just dont remeber how i fixed this.

Changing The Output Of CPU And RAM Usage

I am using the following two commands to output CPU and RAM usage on a Linux machine.

Code:
/bin/grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage "%"}'

/usr/bin/free | grep Mem | awk '{print $3/$2 * 100.0 "%"}'

My problem is that the output is like this

Quote:
5.33672%
13.9723%
Is there a way to output a single number? For example

Quote:
5
13
Thank you

Mounting A USB For Vbox

I am installing VirtualBox on Centos per http://www.digitesters.com/centos-in...adless-system/, and I don't understand the very end. Seems like Line 5 is not needed as it is already done on Line 4, right?

Code:
# mkdir /data/virtual_machines/vbox/vbusbfs
# chown vboxuser.vboxusers /data/virtual_machines/vbox/vbusbfs
# chmod 775 /data/virtual_machines/vbox/vbusbfs
# echo "none /data/virtual_machines/vbox/vbusbfs usbfs rw,devgid=$(awk -F : '/vboxusers/ {print $3}' /etc/group),devmode=664 0 0" >> /etc/fstab
# echo "none /data/virtual_machines/vbox/vbusbfs usbfs rw,devgid=$(awk -F : '/vboxusers/ {print $3}' /etc/group),devmode=664 0 0" >> /etc/fstab
# mount -a

I executed the above script (except didn't execute Line 5, and my user:group is vbox:vbox and not vboxuser.vboxusers, and the folder is at /home/vbox and not /data/virtual_machines/vbox), and the following was added to /etc/fstab. Please explain what Line 4 did and what the below line in my fstab file means.
Code:
none /home/vbox/vbusbfs usbfs rw,devgid=496
504,devmode=664 0 0

I then executed mount -a, and got the following response. The part about /var/www/main/ayb_resources and /var/www/main/ayb_cache does not exist is probably some old stuff which I can get rid of, but I am particularly interested in "mount point 0 does not exist" as it seems to be related to the above.

Code:
[root@devserver vbox]# mount -a
mount: special device /var/www/main/ayb_resources does not exist
mount: special device /var/www/main/ayb_cache does not exist
mount: mount point 0 does not exist
[root@devserver vbox]#

My total fstab file is as follows:

Code:
[root@devserver vbox]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sat Apr 19 05:57:56 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VolGroup-lv_root /                       ext4    defaults        1 1
UUID=xxx-xxx-xxx-xxx-xxx /boot                   ext4    defaults        1 2
/dev/mapper/VolGroup-lv_home  /home                  ext4    defaults        1 2
/dev/mapper/VolGroup-lv_mysql /var/lib/mysql         ext3    barrier=0       1 2
/dev/mapper/VolGroup-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/home/public/lib /var/www/main_lib/ayb_application/lib none bind
/var/www/main/html /var/www/main_lib/html none bind
/var/www/main/ayb_resources /var/www/main_lib/ayb_resources none bind
/var/www/main/ayb_cache /var/www/main_lib/ayb_cache none bind
none /home/vbox/vbusbfs usbfs rw,devgid=496
504,devmode=664 0 0
[root@devserver vbox]# mount -a
mount: special device /var/www/main/ayb_resources does not exist
mount: special device /var/www/main/ayb_cache does not exist
mount: mount point 0 does not exist
[root@devserver vbox]#

CPU & I/O Memory Usage

I have this question which give me a file.tar.gz which include a calculator file and want to extract and run it
in the output it wants to show
1)cpu avg usage
2)total time taken to run
3)memory and I/O usage
can anyone help???

Correctly Measure Available Memory In Linux

I'm currently using the command below, to output the memory usage of a debian system in bash scripts.

Code:
memusage=$(memusage=$(/usr/bin/free | grep Mem | awk '{print $3/$2 * 100.0 "%"}' | cut -d "%" -f1);echo "$(printf "%0.0f\n" $memusage)") && echo Memory Usage is $memusage

Being new to Linux though, I just found out that Linux takes up a lof of memory and puts it in cached.

Code:
root@Client1:~# free -m
             total       used       free     shared    buffers     cached
Mem:           927        799        128          0         15        754
-/+ buffers/cache:         28        898
Swap:           99          0         99

So the first command will actually output that the memory usage is 87%, when in reality is not. Its actually thinking that the memory usage is high because its also counting the cached memory, as used memory.

How can I modify the first command not to consider cached memory, as used memory?

Thanks

Stdout, Stderr And Redirection -- What Is The Correct Order Or Format ?

Hi all,

Been reading on stdin, stdout and stderr and encounter 2 questions, hope gurus here can advise.

0 = stdin
1 = stdout
2 = stderr

Code:
Sun Dec 21 03:53:42 SGT 2014 > cat test5.sh
#!/bin/bash

echo "Please enter value for name :"
read name
echo "Your name is $name."

echo "Next echo will be a syntax error"
ehco

Code:
Sun Dec 21 03:53:46 SGT 2014 > test5.sh 1> output.txt 2> error.txt
Noob

Sun Dec 21 03:54:56 SGT 2014 > cat output.txt
Please enter value for name :
Your name is Noob.
Next echo will be a syntax error

Sun Dec 21 03:55:23 SGT 2014 > cat error.txt
/home/alan/scripts/test5.sh: line 8: ehco: command not found
Sun Dec 21 03:55:26 SGT 2014 >

Which so far all is good and the correct way to output everything including error to a single file is

Code:
Sun Dec 21 03:59:14 SGT 2014 > test5.sh > output.txt 2>&1


Q1) How is a command being interpreted in linux , the sequence in which it is interpreted ? from left to right ? right to left ?

Shouldn't it be

Code:
test5.sh 2>&1 1>output.txt 
or 
test5.sh 2>&1>output.txt ?

Regards,
Noob

Debian Custom Encrypted LVM Install - Impossible To Achieve

Hi there!

After my NVIDIA card died I decided it was time to buy an AMD card again (R9 270X), but I didn't think AMD drivers were such a pain in Linux as people said. Of course, in some distros anyway. On Arch, for example, there's no official release because Arch's developers would have to hold Xorg in order to make a closed-source driver available, because AMD's pace isn't in pair with Linux. So in order to install AMD's drivers on Arch I must rely on some guy's unnoficial repositories, but that isn't the whole problem. Even though I'm cool with adding repos and downgrading Xorg, I'm not cool with it not working for a lot of apps, so that's where I decided to try a few distros. Manjaro is a no-go because it installs Flash as default. openSUSE although is a very good distro, is a complete mess when it comes to repositories, specially multimedia ones. Ubuntu/Mint are also a no-go, Ubuntu because after 12.04 they have a spyware by default, and Mint because it contains non-free stuff by default.

So here I come! I ran Debian in the past for a long time (aside from a breaf period last year) and it was lovely, I could easily set up a custom encrypted install, but now I don't remember how to, and it's killing me. I don't like how the installer doesn't show the partitions size as they actually are, and I don't like how the automated encrypted LVM setup doesn't let me chose the encryption algorithm or the timeframe between each passphrase attempt. That's why I must create my install, and here's what I used to do on Arch (the part that really matters), converted to what I use on Debian:

Code:
# modprobe dm-mod

(create one 1GB partition for /boot, unencrypted ; create another big 930 GB formatted as "8e" - LVM - on dev/sda2)
Code:
# fdisk /dev/sda

(chose my ciphers and iter time)
Code:
# cryptsetup -c twofish-xts-plain64 -y-s 512 --iter-time 5000 luksFormat /dev/sda2

(open the luks container on "sda2_crypt")
Code:
# cryptsetup open --type luks /dev/sda2 sda2_crypt

(create physical volume on sda2_crypt)
Code:
# pvcreate /dev/mapper/sda2_crypt

(create volume group "debian" on sda2_crypt)
Code:
# vgcreate debian /dev/mapper/sda2_crypt

(create volumes)
Code:
# lvcreate -L 8G system -n root
# lvcreate -L 60G system -n swap
# lvcreate -l 100%FREE system -n home

After this is done, I go to the "partition disks" page where I select each partition/volume to it's correct destination. I then procceed to installing the base system, configuring apt, and all that. Now, before I install Grub I used to execute the following commands on shell:

Code:
 # nano /etc/crypttab

I used to put something there, but I don't remember what exactly. It's been a long time since I used Debian for long! But here's what I put the

Code:
sda2_crypt /dev/mapper/sda2_crypt none luks

Then I procceeded to instal syslinux (I REALLY don't like GRUB)

Code:
# chroot /target
# apt-get install syslinux

But I get the following error:

Quote:
E: cannot write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory).
I'm assuming this is just a non-critical error. But this is not the problem, the problem is when I try to install syslinux:

Code:
# syslinux-install_update -i -a -m

The output:

Quote:
/bin/sh: 2: syslinux-install_update: not found
Then I type "syslinux --help":

Code:
# syslinux -h

Quote:
Usage: syslinux [options] device
--offset -t Offset of the file system on the device
--directory -d Directory for the installation target
--install -i Install over the corrent bootsector
--update -U Update a previous installation
--zip -z Force zipdrive geometry (-H 64 -S 32)
--sectors=# -S Force the number of sectors per track
--heads=# -H Force number of heads
--stupid -s Slow, safe and stupid mode
--raid -r Fall back to the next device on boot failure
--once=... Execute a command once upon boot
--clear-once -O Clear the boot-once command
--reset-adv Reset auxilliary data
--menu-save= -M Set the label to select as default on next boot
--force -f Ignore precautions
I tried literaly every possible combination that would make sense in Arch and yet I can't install it. The Debian documentation on syslinux doesn't help at all, and the Arch's Wiki on Syslinux... well, tells how to make it work on Arch It used to work the same way on Debian, but now it doesn't.

Here's a little list of the errors I get:

Code:
# syslinux -i -U

Quote:
Usage: syslinux [options] device
--offset -t Offset of the file system on the device
--directory -d Directory for the installation target
--install -i Install over the corrent bootsector
--update -U Update a previous installation
--zip -z Force zipdrive geometry (-H 64 -S 32)
--sectors=# -S Force the number of sectors per track
--heads=# -H Force number of heads
--stupid -s Slow, safe and stupid mode
--raid -r Fall back to the next device on boot failure
--once=... Execute a command once upon boot
--clear-once -O Clear the boot-once command
--reset-adv Reset auxilliary data
--menu-save= -M Set the label to select as default on next boot
--force -f Ignore precautions
Code:
#syslinux --install --update

Quote:
Usage: syslinux [options] device
--offset -t Offset of the file system on the device
--directory -d Directory for the installation target
--install -i Install over the corrent bootsector
--update -U Update a previous installation
--zip -z Force zipdrive geometry (-H 64 -S 32)
--sectors=# -S Force the number of sectors per track
--heads=# -H Force number of heads
--stupid -s Slow, safe and stupid mode
--raid -r Fall back to the next device on boot failure
--once=... Execute a command once upon boot
--clear-once -O Clear the boot-once command
--reset-adv Reset auxilliary data
--menu-save= -M Set the label to select as default on next boot
--force -f Ignore precautions
Code:
# syslinux --install --update -i -a -m

Quote:
Usage: syslinux [options] device
--offset -t Offset of the file system on the device
--directory -d Directory for the installation target
--install -i Install over the corrent bootsector
--update -U Update a previous installation
--zip -z Force zipdrive geometry (-H 64 -S 32)
--sectors=# -S Force the number of sectors per track
--heads=# -H Force number of heads
--stupid -s Slow, safe and stupid mode
--raid -r Fall back to the next device on boot failure
--once=... Execute a command once upon boot
--clear-once -O Clear the boot-once command
--reset-adv Reset auxilliary data
--menu-save= -M Set the label to select as default on next boot
--force -f Ignore precautions
Oh, and also users are still not able to press TAB to get the full command without typing it? And we can't even press the up arrow key that we get "^[[A"? :P Whaat?

What am I doing wrong?

I'm really not with the time to mess with these kinds of things, so either I figure this out REAL SOON or I'll be forced to get back to Windows