Programming :: Get Uuid Of A Device / Partition In System Programatically?

Mar 13, 2011

I am very much new to Linux programming. My question is Is there any way to read UUID of a device or partition in linux programatically. Is there any c/c++ API for user-space applications. I found some commands "sudo vol_id --uuid /dev/sda1", "sudo blkid", "ls -l /dev/disk/by-uuid/". But all are commands which we need to run in terminal. But i need to achieve this from a c/c++ program. Can some one help me in this problem.(FYI: I need to read uuid of root filesystem ("/") where Linux has been installed.)

View 9 Replies


Programming :: How To Get UUID Of Device / Partition

Mar 13, 2011

I am very much new to Linux programming. My question is Is there any way to read UUID of a device or partition in linux programatically. Is there any c/c++ API for user-space applications. I found some commands "sudo vol_id --uuid /dev/sda1", "sudo blkid", "ls -l /dev/disk/by-uuid/". But all are commands which we need to run in terminal. But I need to achieve this from a c/c++ program. (FYI: I need to read uuid of root filesystem ("/") where Linux has been installed.)

View 1 Replies View Related

Programming :: Get From A Disk UUID To A Device Name?

Oct 4, 2010

Is there any C function that will translate UUIDs into device names? I have a little graphical mount tool that can read user-mountable device names from /etc/fstab and lets you cycle through the list and mount or unmount them. But it doesn't work with UUIDs, which are preferred these days. Is there any way around this?

View 2 Replies View Related

Software :: Programatically Determine Device In RAID Array?

Oct 30, 2009

I'm writing a bash script that needs to know whether or not a device node is part of a RAID array. I'm just curious if anyone knows of a good way to determine if a device node is in a RAID array. I know that you can run mdadm -Q or mdadm --examine on the device node and that will tell you. But I don't want to rely on screen scrapping and would rather have something that would return a boolean. Any ideas?

View 2 Replies View Related

General :: Command To Display The Device-fs-uuid-mount Point?

Oct 26, 2010

I need a command to display the next info from my hdd:

device name - filesystem - uuid - mount point

I found blkid but the mount point is not displayed, I've already look in man but there is no parameter for that

View 2 Replies View Related

Debian :: Use Udev Rules To Prevent HDDs To Change Device Instead Of Using UUID In /etc/fstab?

Dec 15, 2010

UUIDs make fstab hard to read, so.. Is it possible to use udev rules to prevent HDs to change device, instead of using UUID in /etc/fstab?

View 2 Replies View Related

Ubuntu Installation :: USB Key Isn't Present (with Error: No Such Device And The Uuid) - And Hangs On A Blinking Cursor?

Mar 15, 2011

I just attempted to install to a USB drive, and somehow in the process, GRUB overwrote my Windows 7 bootloader on the internal disk. My work laptop is now booting into a grub recovery whenever my USB key isn't present (with error: no such device and the uuid) - and hangs on a blinking cursor whenever the key is plugged in.I'm not familiar with what my options are for grub rescue, but ls shows (hd0) (hd0,msdos2) (hd0,msdos1) (fd0)

My laptop is encrypted, so I don't have much chance of recovery unless I can get back to the windows bootloader.

View 7 Replies View Related

Ubuntu :: How To Restore Partition UUID

Sep 4, 2010

After installing another OS on second drive, UUID for swap on my main system was missing. In other words there is no appropriate symlink in /dev/disk/. I've tried to create it manually, but it dissappears again after rebooting. Temporarily i solved this problem by adding in /etc/fstab direct address to swap device. The question is how to restore UUID for swap partition correctly?
sudo blkid /dev/sda6
/dev/sda6: TYPE="swap"
/dev/sda6 is swap partition.
Also i've tried to use tune2fs:


View 3 Replies View Related

Debian :: Change The UUID Of A Partition?

May 9, 2011

I have, as I have in the past, copy/pasted a partition using gparted to get a working OS to another place.

I have always done this in the past to a different drive. Never paid much attention to the UUID.

This time I did it on the same drive. The partitions have the same UUID. This is not a good thing.

The copied OS boots and mounts fine as I edited the fstab to go by /dev/sdxy (where x is the drive and y the partition). My grub uses a custom menu using symbolic menu entries so it goes by the partition definition instead of UUID too.

I would really like to change the UUID on that partition.

View 8 Replies View Related

CentOS 5 Server :: Mount: Special Device UUID=fb518c74:2b6bd0f4:66db5ce6:7e004239 Does Not Exist

Mar 1, 2011

I seem to have another issue with my raid system

mount -a
mount: special device UUID=fb518c74:2b6bd0f4:66db5ce6:7e004239 does not exist

but when i do mdadm -vv --detail /dev/md5 ... this is what i get --->

Version : 1.1
Creation Time : Fri Feb 25 14:07:36 2011
Raid Level : raid1


View 3 Replies View Related

General :: Swap Partition UUID Changed - What To Do

Jun 5, 2010

Someone (not me) recently installed some new distros on my HD. It seems that during the installation my swap partition was reformatted and a new UUID was assigned to it. I have the following questions:

1. I know that I have to change the swap partition UUID in /etc/fstab and /boot/grub/menu.lst of the affected distros. Is there anything else that needs to be changed?
2. I presume a similar change has to be made to the Grub 2 configuration, for those distros that use Grub 2. I have no experience using Grub 2 so how do I make the change or where can I find instructions to do it?

View 13 Replies View Related

CentOS 5 :: Error Mounting Device UUID=cee298a0-9c47-4a3a-ac84-23db4d20edd5 As /. No Such File Or Directory

Dec 22, 2009

CentOS 5.3 has been running fairly good except for a slow ethernet connection so I thought I would upgrade to CentOS 5.4 to see if that improved things. I had previously changed fstab and menu.lst to use UUID instead of LABEL in order to insulate myself from partition label changes I wanted to make. This worked fine in CentOS 5.3. When I attempted to upgrade from 5.3 to 5.4 using the installation disk and telling it to upgrade rather than do a new install, the installation correctly found my root partition as /dev/sdb8. When I proceeded with the upgrade I received the error:

"Error mounting device UUID=cee298a0-9c47-4a3a-ac84-23db4d20edd5 as /. No such file or directory. This most likely means the partition has not been formatted."

But of course it has been formatted and is my / partition running CentOS 5.3 as I type. how to fix this to get CentOS 5.3 upgraded ? Di I have to use LABEL in fstab and menu.lst for my partitions,or perhaps just for my root partition ? Any other ideas why this is failing ?

View 1 Replies View Related

Ubuntu :: Boot Failure - Can Not Find Root Partition No Uuid

Mar 5, 2010

I posted this first to thread 'Boot problem - "Gave up waiting for root device.", (initramfs)' then realized that I should start a new thread because the problem is not the same. On boot the splash goes black and nothing happens, On a recovery boot it drops into shell BusyBox and messages indicate that the root partition cannot be found. After booting from CD Gparted GUI partition information shows no label or ssid for the root partition sda2. The data for the root partition appears to be there. how to fix this? My /home, swap, and / are on separate partitions formatted ext3. I have a recent backup only for my data. I would like to avoid having to rebuild my system from scratch.

View 9 Replies View Related

Programming :: UUID Save As A Variable?

Jul 22, 2010

I am new to linux scripting, but I have programming experience. I need to save the UUID for /dev/sda1 as a variable, lets call it id. I am sure there is a way to do this with the awk and blkid commands, but I do not know any of this well enough yet to figure it out and after a couple of hours of reading I am still lost as to exactly how I would put this together. I need to save the uuid as a variable so that I can run an if statement with it

if [ -f /media/$id/file ]
echo "copy successful"
echo "oh crap!"

honestly all I need the uuid for but I cant check this by doing the same if with /dev/sda1/file so I need to be able to save the uuid into a variable

View 7 Replies View Related

Ubuntu Installation :: Grub2 - Error: "no Such Device : <UUID Ending In 4ec05>"

Dec 11, 2010

So I've a computer with a lot of disks which is running Ubuntu 9.04. The setup is made od a software raid 1 array of 200 MB for use in /boot (md0), then another raid1 array of the remaining space as a unique PV for the LVM2 vg0. This vg0 is split in many lv, for /, /usr .... and swap. A few days back, one of the raid1 disk went wrong. So as the raid is built on 160Gb disks and nobody in my town sells so little disks I bought a couple of 320GB disks. The partitioning was made like the original partitions, except that the second partition is way bigger than it was. I replaced the failed disk in the arrays, and now I've an md0 of 200 MB and an md1 of roughly 150GB as it was previously and all is in sync. This replacement was made using a rescue disk (in order to be sure that the machine was not locking anything...)

So I thought it was fine. But upon reboot on the hard disks, I get a fast GRUB message "error: no such device : <UUID ending in 4ec05>. when I start the first Ubuntu entry I get the same error. So I edit the boot entry, remove the "search --no-floppy --fs-uuid --set <UUID ending in 4ec05> " and boot the damn thing. When booted I ran :


View 9 Replies View Related

Programming :: How To Know The Primary Partition Of A System

Feb 28, 2011

I have to write a script or program to log the details of the primary partition of a linux server which should be generic. Can anyone tel what is the command in linux to get the list of the partitions and how to find the primary partition among the other. Or can I know from proc filesystem.

View 3 Replies View Related

Programming :: Get Uuid Value From Variable Block Got From Menu?

Apr 26, 2010

I try to get uuid value from variable block got from menu.lst.This try does not work. What is wrong?

uuid=$( echo $block | awk --re-interval '/(root=UUID=/{ x=gensub(/([0-9a-f-]{36,36})/,"\1","g");
print $1}')

View 14 Replies View Related

Ubuntu :: System Halted During Boot - Swap Waiting For UUID

Mar 29, 2010

I've just upgraded my wife's netbook to UNR 9.10. This seemed to go well and the netbook has been working fine since. Yesterday my daughter used the netbook with out any issues, but when my wife tried it halted during boot with:

Swap waiting for UUID: xxxxxxxxxxxxxx

After a couple of reboots it started working fine, but looking at /etc/fstab the entry for swap is different to the UUID shown in blkid Do I just update fstab with the UUID from blkid?

View 2 Replies View Related

Ubuntu :: Safe To Change Fstab UUID Entry For The System To /dev/sdb4?

Nov 13, 2010

is it safe to change fstab UUID entry for the system to /dev/sdb4? and after editing fstab, is there a script or command I need to run to release lock or update mount information? edit: I see not correct, and therefore not safe,but is there a format to tell linux to use /dev/sda1 instead of UUID= or label= .

View 9 Replies View Related

Ubuntu :: Accessing Drive When Fstab Contains UUID's / No Longer Pertinent To Any Hardware On System

Jul 8, 2011

I cloned one of my hard drives to another, using Acronis True Image Home 2011.In the process, of course, fstab got copied verbatim from old to new.I then, using a livecd on a flash drive, mounted the new drive, went into fstab and rewrote the UUID's, using the numbers I'd gotten previously by doing sudo blkid.Now, the new drive had the UUID's revealed by that command.Then, I used boot-repair, from yannubuntu, to make that drive bootable, since it wasn't after the cloning and after the fstab rewrite.The drive is bootable, and it's mountable from a flash drive, or from the old drive.

I can access files either way.the fstab file on the new drive still has the old numbers, yet when I ran boot-repair, it apparently changed the UUID's for sectors 1 and 5 on the new drive.fstab seems to be irrelevant at this point, yet everything I read about it indicates that it is not only relevant, but necessary.I don't understand how I can be accessing the drive when the fstab contains UUID's that are no longer pertinent to any hardware on my system.

View 5 Replies View Related

Networking :: How To Enable DHCP Programatically

Mar 23, 2010

I am doing a project on which i need to switch between dhcp and manual network configuration. I want to know how can i set dhcp programatically. I will not be able to edit any config files as my file system is read only. i am looking for some APIs which could do the task.

View 2 Replies View Related

Software :: Programatically Feed Top With Key Strokes?

Aug 30, 2010

I'm writing a simple bash script and I would like it to be able to to execute top (that's the easy part) and then to supply the parameters to top

Here is the explanation:
Top is an interactive program that requires user input to do stuff, sort etc. I would like to programatically do so, for example:

supply input;
get info;

Is it possible with simple bash?

View 4 Replies View Related

CentOS 5 :: Convert Some RTF Files To PDF Programatically?

Jan 23, 2011

We need to convert some RTF files to PDF programatically, so cli needed. Used Ted before. [URL].. Whats the best way to find a repo that will install Ted into CentOS 5.5 ? Otherwise I'm stuck with rpm and failed dependencies.

View 10 Replies View Related

Software :: Changing An NTFS UUID - Restore An NTFS Partition From A Backup?

Dec 25, 2010

I am trying to restore an NTFS partition from a backup and I need the new drive to have the old (dead) drive's UUID (which I recorded).I really really really cannot use the option of changing fstab to mount using a new UUID, for this case I need the old UUID that existed on the other drive.Is there some ntfs equivalent of tune2fs that'll let me change the UUID on an ntfs partition?

View 4 Replies View Related

Software :: Remove Chunks From A Video File Programatically?

Oct 22, 2009

I need to remove sections from video files (from the middle and the end) on the command-line. Generally these will be mp4 and avi files.

For instance, I have a .mp4 file which is 32:30 minutes long. I'd like to remove from 2:49 to 3:20, and remove the last 60 seconds.

Any ideas on how I can achieve this?

View 1 Replies View Related

Ubuntu :: Get The Card Number And Device Number On System For Attched USb Audio Device?

Oct 1, 2010

how to get the card number and device number on system for attched USb audio device?

View 3 Replies View Related

Programming :: Searching For Video Or Screen Cast Which Shows Device Driver Programming?

May 30, 2010

I did searched you tube but my results were not great.I have 2 books on KernelProgramming.I feel I need if some where I can get a video tutorial which can help me to understand how to develop a Linux Device driver that will be great.I had a look at Greg Kroah Hartmans video lecture of developing patches on ......I have been reading books and a lot of stuff.So I wish if I could get a video lecture that would be better

View 1 Replies View Related

General :: Automating USB Drive Configuration Of Partition Table, Partition And File System

Jan 26, 2011

I have tried to automate the configuration of a usb drive with not much success.

The problem that I have is that I have a large amount of usb drives that have a partition table of type "loop" and I need to change them to "msdos". The size of the drives vary and I need to use FAT32 or FAT16 file system.

I've tried various partitioning commands and gui applications but cant find one that I can give a one line command to to set the partition table, maximum partition size and file system.

View 9 Replies View Related

Debian :: Separate /home Partition From System Partition - Free Space Gone?

Dec 15, 2010

My debian 5 is up and running smoothly and act as file-server in the middle of windows network jungle using samba the only problem is, after backup an external hdd (213 GB) to my /home partition, I end up with message say that I'm running out free space. Fyi my debian installed on 1TB SATA disk, and I separate my /home partition from system what happen to my free space ? here is screenshot of my disk, using disk usage analyzer: is there is a way to get my space back or something missing on my setup.or I have to reinstall my debian and use LVM when partitioning my disk?

View 8 Replies View Related

Ubuntu :: Cannot Move /var/www To Other Device - Partition / Fix It?

May 5, 2010

I'm trying to move the /var/www dir to another partition (another hard drive even, though I doubt that makes a difference) because my file system partition is rather small. But when I do I get "403 -forbidden" and in the logs "Permission denied: /home/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable". If I move it anywhere within the partition (and adjust the conf) I don't get this problem. Using Ubuntu 10.04 Desktop x64. I haven't had any problems with this in earlier Ubuntu-versions.

View 6 Replies View Related

Copyrights 2005-15, All rights reserved