LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
LinkBack Search this Thread
Old 02-26-2010, 09:50 AM   #1
pcsousa
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Rep: Reputation: 0
Mount an ISO made with dd if=/dev/sda2 of=/backups/backup.iso


Dear Sirs,

this is my structure:
[root@ iso]# fdisk -l

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 30401 244091610 8e Linux LVM

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 121601 976760001 83 Linux
[root@ iso]#

As backup solution I'm trying this (making backup of entire sda to /backups/backup.iso):
dd if=/dev/sda2 of=/backups/backup.iso

This is creating a 250GB ISO (entire sda hard drive).
I do not know how to restore this.

I tried:
mount -o loop -t rootfs /backups/backup.bck.iso /mnt/iso

This cmd created this directory structure:
[root@ iso]# ls -la
total 8
drwxr-xr-x 11 root root 0 Feb 26 11:07 .
drwxr-xr-x 4 root root 4096 Feb 26 15:30 ..
drwxr-xr-x 31 root root 0 Feb 26 14:57 block
drwxr-xr-x 14 root root 0 Feb 26 11:08 bus
drwxr-xr-x 31 root root 0 Feb 26 11:08 class
drwxr-xr-x 12 root root 0 Feb 26 11:08 devices
drwxr-xr-x 3 root root 0 Feb 26 11:07 firmware
drwxr-xr-x 2 root root 0 Feb 26 11:07 fs
drwxr-xr-x 4 root root 0 Feb 26 15:26 kernel
drwxr-xr-x 112 root root 0 Feb 26 14:58 module
drwxr-xr-x 2 root root 0 Feb 26 15:26 power
[root@ iso]#

[root@ iso]# du -h|more
0 ./module/nls_utf8/sections
0 ./module/nls_utf8
0 ./module/hfsplus/sections
0 ./module/hfsplus
(...)
0 ./fs
0 .
[root@ iso]#

This is sda original structure:
[root@ iso]# cat /etc/fstab
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
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
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
/dev/sdb1 /backups ext3 defaults 1 2

And I want to restore some files from /dev/VolGroup00/LogVol00.

Can you help me?

Thank you.
 
Old 02-26-2010, 11:42 AM   #2
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 355

Rep: Reputation: 43
I was not able to find the rootfs type in "man mount". Even if this worked, how would you get your volumes without telling LVM about them? Maybe dd out to another drive and boot from it?
 
Old 02-26-2010, 12:05 PM   #3
minrich
Member
 
Registered: Aug 2003
Location: Isles of Man & Wight
Distribution: See signature
Posts: 548

Rep: Reputation: 40
I may be wrong but from the code that you present it appears that you have failed to direct the output 'of=' to /dev/sdb1 your output command should be of=/dev/sdb1/backups/backup.iso.

I don't understand why you are using the extension '.iso' since this is a file system for CDs and DVDs and I would suspect that both your sda1 and sdb1 are formatted as ext3 or ext4. The 'normal' use of the 'dd' command is to name the output file as a '.image' file, not that it makes any difference, in linux, what the file ending is - it is the first characters of a file that determine what or how the file can be read.

So unfortunately it appears that you have written, or at least tried to write 250GB to a file on your sda drive. I somehow doubt that you were successful since even if it worked it would have taken about 2 and 1/2 hours minimum.

If you seriously want to duplicate (clone) your sda drive to a file on your sdb drive then I would suggest that you boot your machine with a liveCD so that your sda drive is not mounted.

By the way what distro are your using, and does it still boot.

You may want to read http://www.linuxquestions.org/linux/...ything_With_DD before proceeding further.
 
Old 02-26-2010, 12:58 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,561

Rep: Reputation: 684Reputation: 684Reputation: 684Reputation: 684Reputation: 684Reputation: 684
You can not mount an entire disk image since it can not deal with the MBR/partition table. However you can ignore it by offseting the number of bytes. I've never tried to mount an LVM as a loopback device but this post looks like it might work. Trying to mount a volume group with the same name might cause problems.

http://www.thegibson.org/blog/archives/467
 
Old 02-26-2010, 06:04 PM   #5
pcsousa
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Thank you for your replies.

Our distro:
[root@ vm]# cat /etc/redhat-release
CentOS release 5.4 (Final)
[root@ vm]#
[root@ vm]# uname -a
Linux 2.6.18-164.11.1.el5.centos.plus #1 SMP Wed Jan 20 18:49:35 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
[root@ vm]#

It's everything working well (machine is booting well) except I can't get a VMWare disk (from ISO) I deleted by mistake (from sda). We have a little old manual backup of that VM disk and it is already running but we have several specific oracle and informix configurations made last week on that VM and we didn't made an howto yet, so we are trying not to loose all week work. ISO backup is made every night. Unfortunatly this backup solution kind is recent for me, so I never tried to restore it before... I know it is a big mistake not to try it before, but its the truth.

Now I'm running another dd command every day and already tested it well (dd if=/dev/VolGroup00/LogVol00 of=/backups/backup.work.partition.iso)
This way we have all working structure available in seconds with mount -o loop ./backup.work.partition.iso /mnt/iso

[root@ vm]# ls -la /mnt/iso
total 236
drwxr-xr-x 27 root root 4096 Feb 26 11:08 .
drwxr-xr-x 4 root root 4096 Feb 26 15:30 ..
-rw------- 1 root root 13 Feb 26 11:07 .asterisk_history
-rw-r--r-- 1 root root 0 Feb 26 11:08 .autofsck
-rw-r--r-- 1 root root 0 Oct 26 09:25 .autorelabel
drwxr-xr-x 5 root root 4096 Oct 24 11:06 BACKUP
drwxr-xr-x 2 root root 4096 Jan 22 23:22 backups
drwxr-xr-x 2 root root 4096 Feb 6 06:44 bin
drwxr-xr-x 2 root root 4096 Jan 2 2002 boot
drwxr-xr-x 4 root root 4096 Jan 2 2002 dev
drwxr-xr-x 97 root root 12288 Feb 26 17:00 etc
drwxr-xr-x 8 root root 4096 Dec 15 12:14 home
drwxr-xr-x 11 root root 4096 Feb 11 23:39 lib
drwxr-xr-x 7 root root 4096 Feb 11 23:39 lib64
drwx------ 2 root root 16384 Jan 2 2002 lost+found
drwxr-xr-x 2 root root 4096 Mar 11 2009 media
drwxr-xr-x 2 root root 4096 Jan 21 2009 misc
drwxr-xr-x 4 root root 4096 Feb 26 15:30 mnt
dr-xr-xr-x 2 root root 4096 Jan 17 2002 net
drwxr-xr-x 4 root root 4096 Dec 16 11:15 opt
drwxr-xr-x 2 root root 4096 Jan 2 2002 proc
drwxr-x--- 10 root root 4096 Feb 26 17:00 root
drwxr-xr-x 2 root root 12288 Feb 6 06:44 sbin
drwxr-xr-x 2 root root 4096 Jan 2 2002 selinux
drwxr-xr-x 2 root root 4096 Mar 11 2009 srv
drwxr-xr-x 2 root root 4096 Jan 2 2002 sys
drwxrwxrwt 9 root root 4096 Feb 26 17:00 tmp
drwxr-xr-x 15 root root 4096 Jan 2 2002 usr
drwxr-xr-x 23 root root 4096 Jan 1 22:38 var
drwxr-xr-x 2 root root 4096 Dec 10 19:28 .vmware
[root@ vm]#

minrich, /backups/backup.iso points to /dev/sdb1 (/dev/sdb1 /backups ext3 defaults 1 2). This way we are making a copy of /dev/sda2 to /dev/sdb1 (at least I thought...).

michaelk, the article seems what I need. Why do you say "Trying to mount a volume group with the same name might cause problems."? Do you think I should test to mount it on another machine?

Regards.
 
Old 02-26-2010, 06:22 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,561

Rep: Reputation: 684Reputation: 684Reputation: 684Reputation: 684Reputation: 684Reputation: 684
All the Volume Groups visible to a system need to have different names. Are you mounting the drive in a VM?

http://linux.die.net/man/8/vgrename

Last edited by michaelk; 02-26-2010 at 06:27 PM.
 
Old 02-26-2010, 06:30 PM   #7
pcsousa
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Original Poster
Rep: Reputation: 0
By the way, mount was not with rootfs. It was with sysfs.
 
Old 02-26-2010, 06:32 PM   #8
pcsousa
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Original Poster
Rep: Reputation: 0
michaelk, no. This copy is from the host machine. So I need to mount it on a system with different partitioning... grrr.

Thank you.
 
Old 02-26-2010, 06:33 PM   #9
pcsousa
LQ Newbie
 
Registered: Feb 2010
Posts: 7

Original Poster
Rep: Reputation: 0
By the way, not rootfs but sysfs!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mount ISO as specific device (ie: /dev/sda1) with GRUB2 to boot KNOPPIX live cd iso BLuFeNiX Linux - General 2 12-23-2009 01:31 AM
LXer: Mounting ISO Images With Furius ISO Mount On Ubuntu 8.04 Desktop LXer Syndicated Linux News 0 09-26-2008 04:30 PM
RHEL CDs: made iso, mounted iso, exported dir - still asks for CD :( guest Linux - Newbie 1 04-08-2005 12:37 PM
Does anyone Know how to open either .iso.rz or these .iso.xdelta,.iso.bz2,.iso.lzma?? maximalred Debian 5 06-09-2004 06:15 AM
mount a .iso or extract a .iso behind user witout access to root easytarget Linux - Newbie 3 09-29-2002 05:01 AM


All times are GMT -5. The time now is 03:14 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration