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
ADVERTISEMENT
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
View Related
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
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
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
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
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?
Code:
sudo blkid /dev/sda6
/dev/sda6: TYPE="swap"
/dev/sda6 is swap partition.
Also i've tried to use tune2fs:
[Code]....
View 3 Replies
View Related
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
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 --->
/dev/md5:
Version : 1.1
Creation Time : Fri Feb 25 14:07:36 2011
Raid Level : raid1
[code]....
View 3 Replies
View Related
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
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
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
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 ]
then
echo "copy successful"
else
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
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 :
[Code]...
View 9 Replies
View Related
Apr 26, 2010
I try to get uuid value from variable block got from menu.lst.This try does not work. What is wrong?
Code:
uuid=$( echo $block | awk --re-interval '/(root=UUID=/{ x=gensub(/([0-9a-f-]{36,36})/,"\1","g");
print $1}')
View 14 Replies
View Related
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
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
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
Jun 18, 2010
I have just bought 4 1TB drives and set up a Software Raid level 5. Using Disk Utility tool I have created a GPT partition table and now when I want to create a partition, I get:
Error creating partition: helper exited with exit code 1: In part_add_partition: device_file=/dev/md0, start=0, size=3000610848768, type=
Entering MS-DOS parser (offset=0, size=3000610848768)
MSDOS_MAGIC found
found partition type 0xee => protective MBR for GPT
[Code].....
it does say nothing about creating an partition on the /dev/md0, although Gnome Disk Utility allows to do that - if I just run mkfs.xsf /dev/md0 - it works fine, yet Disk Utility tells me that disk has not been partitioned, see image:
View 1 Replies
View Related
Jun 1, 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 2 Replies
View Related
Sep 23, 2010
Have VMWARE workstation 7. Have to extend partition /dev/sda1 mounted to /home/user
1. Originally /dev/sda was 10gb I've extended device via VMWARE to 30gb.
2. When I do: fdisk /dev/sda it tells me that /dev/sda 30gb
3. when I check: df -h /home
it shows 10GB
4. How I can make Linux see the 30gb at /home/user?
View 5 Replies
View Related
Feb 26, 2011
I am finally, and happily ditching Windows IIS, SQL Server, and ASP in favor of LAMP. Not only will I save a bunch of money on operating systems but I've found php and MySQL development to be much faster than their Microsoft counterparts.Currently I have two W2008 and two Ubuntu servers running and doing virtually parallel tasks. I want to can the W2008 machines but I am not 100% sure of my Ubuntu mirrors.Everything seems to be working fine. I've copied tons of data back and forth as a primitive test but sometimes things work fine for all the wrong reasons. Here's where I get confused.
Question 1:Do I need to partition the RAID device (MD0) and then format it?From my experience this is necessary to get the device to mount.
Question 2:In this case was it also necessary to format the individual drive partitions?
Question 3:If I do a daily cat /proc/mdstat is this all I need to do to check the drive status.
Question 4:Is there any other check I can do to assure that the mirrors are created, mounted, and operating correctly?
View 3 Replies
View Related
Apr 30, 2010
I have installed 1tb hard drive and would like to partition as follows:
1) / - 20g
2) /swap - 6G
3) /photos /150g
4) /videos /500g
5) /audio /300g
After 2-3 partition an extended partition automatically created in which I am not able to create specified capacity i.e., say I want 150g of /photos partition, the /videos partition is automatically reduced and a free space at the end appears. Some free space is always there which i am not able to understand. Nevertheless i clicked to create, but I get an error viz. 'device not created'.
View 7 Replies
View Related
Dec 2, 2010
Does anyone know of a command I can use to partition a device without entering any menus? I want to run the command with all config parameters and flags like disk size, device name, partition number and type, etc and it should just create the required partition.
View 5 Replies
View Related
May 11, 2010
When installing I am selecting the manual partitioning scheme( I have arch on another partition). After I have selected my custom partitions and their mount points it starts the installation but almost immediately it gives the error message that it cannot create a partition on the specified one, as it is used by the OS. I have also tried to create partitions through gparted in the live session but to no avail. I am sure that no partitions are mounted or in use by the system, I have checked this using the mount and fuser commands. I also tried the oem installation but the result the same.
View 3 Replies
View Related
Jul 7, 2011
I have a HP Pavilion dm4-1177 (640GB HDD, 6GB RAM, Windows 7 Home Premium 64 bit os, Intel core i5 2,4GHz).I tried to install Ubuntu 11.04 (both 32 bit and 64 bit) using the wubi, on a separate partition I keptexclusively for linux (10GB). During the mid-way of installation, it said:
An error ocurred:
Error executing command
>>command=C:Windowssysnativecdedit.exe/set{c644fa11-0e.......................} device partition=H:
[code]....
View 5 Replies
View Related
Mar 25, 2010
I have installed vmware in windows server 2003 enterprise edition. When I installed I changed the default installation folder from c: drive to i: drive, as I do not have space in c: drive. After I captured red hat linux cd in vmware and reached partitioning section and continued I got a message like "an error has occured no valid devices were find on which to create new file systems, please check the hardware for the cause of the problem". The machine is IBM server....
View 1 Replies
View Related
May 2, 2010
I have created a logical partition (/dev/sda5) and have formatted it with an ext3 filesystem and given it the label PHOTOS.
# mkfs.ext3 -L PHOTOS /dev/sda5
If I mount it to my /PHOTOS directory manually, it does so correctly. However, when I try to automount, it gives me this message:
# mount -a
mount: special device PHOTOS does not exist
I've entered this line in my fstab file:
PHOTOS/dev/sda5ext3defaults0 0
I'm just not sure what's happening; I've never had trouble mounting a filesystem before. Oh and it's a RHEL 5 installation.
View 2 Replies
View Related
Jul 19, 2011
So I cant seem to be able to install fedora 15. I think it is the disk. I have windows 7 already installed (and would like to keep it) It was installed on the end of the hard drive leaving a 100 GB chunk in the center of the drive open and unformatted (this may be the problem). Anyway I used the live cd and tried to format the unformatted partition to exf but it gives me this error
Code:
Error creating partition: helper exited with exit code 1: In part_add_partition: device_file=/dev/sda, start=105906176, size=104752742400, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
Entering MS-DOS parser (offset=0, size=500107862016)
MSDOS_MAGIC found
found partition type 0xee => protective MBR for GPT
Exiting MS-DOS parser
Entering EFI GPT parser
GPT magic found
partition_entry_lba=2
num_entries=128
size_of_entry=128
Leaving EFI GPT parser
EFI GPT partition table detected
containing partition table scheme = 3
got it
got disk
new partition
added partition start=105905664 size=512
committed to disk
Error doing BLKPG ioctl with BLKPG_ADD_PARTITION for partition 2 of size 105905664 at offset 512 on /dev/sda: Device or resource busy
Do I have to reinstall windows for this to work or is there something I can try to do.
View 2 Replies
View Related
Apr 5, 2011
I have two partitions on my HDD. A Windows XP (hd0,2) and an Ubuntu 9.10 (hd0,1).I have been using the Windows mainly and ran a program that changes the HDD's serial number. Now when I boot up and Grub loads, I try to access the Windows partition and get the following error:
Error: No Such Device: 2e3857fb3857c08f
I am still able to boot the Ubuntu partition but can not seem to get grub to point to the Windows partition any more. This is very frustrating as I really need to get back into that partition soon.
View 9 Replies
View Related