Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
to resize a logical partition, i recently took a backup of it using dd using the command:
Code:
dd if=/dev/hda5 of=/backup/hda5-22oct2008.bak.dd
then i resized the partition using parted and now i can't restore the backup into my newly resized partition /dev/hda5 with this simple command
Code:
dd if=/backup/hda5-22oct2008.bak.dd of=/dev/hda5
because it messes up the filesystem!!
how can i extract the raw data from /backup/hda5-22oct2008.bak.dd
there must be a way to do it, right?
ps. yeah, i should have just done a simple cp, i know. it was stupid of me to not do it. agreed. but whatever done is done, right? will really appreciate your help though!
Last edited by microcriminal; 10-22-2008 at 06:17 PM.
The dd image contains all the filesystem overhead + all the files. As you already have observed, you can't cram all that back into a smaller space.
When you say "extract", I think you mean extract the FILES--so that you can put them into the newly re-sized partition. I believe you can mount the image as if it were a partition. I've never done this, so look at the man page for mount---or maybe Google on "mount loopback".
Next time around, consider re-sizing the partition (data and all) using something like GParted. (After, of course, backing up the data)
Depends what you mean by messing with the filesystem. If you made the partition bigger, then dd'd back, it'll recreate the smaller filesystem in the enlarged partition.
Just like you told it to by using dd.
Shouldn't be a problem - most filesystems allow resize in this situation these days
pixellany got it right. Your backup file is a filesystem image, which can be mounted. As root, create a directory to act as the mount point, for example /LOOP, and mount it as follows:
Code:
mount -t iso9660 /backup/hda5-22oct2008.bak.dd /LOOP -o loop
hey guys! thanks a lot for your response! really appreciate it...
i tried mounting the backup like drchuck mentioned but got this error:
Code:
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
the dmesg | tail tells me this:
Code:
Unable to identify CD-ROM format.
any idea about what is going on?
Last edited by microcriminal; 10-25-2008 at 06:28 AM.
If you have used dd to backup a logical partition, it should not be easy to determine the filesystem type. The file command may give you some direction.
root@noc-101 ~]#file /backup/hda5-22oct2008.bak.dd
/backup/hda5-22oct2008.bak.dd: data
shows it to be a data i.e. anything else other than text or exectuable (data is usually 'binary' or non-printable).
not much help with that either i guess?
Indeed "data" is the answer when the file command does not recognize any file type. As a last resource you can try to associate a loop device with the file, then try the fdisk -l command to gather some information, for example
I suggest you try with a loop mount with an offset.
Quote:
mount -o loop,offset=32256 /backup/hda5-22oct2008.bak.dd /foo
where /foo is a mount point.
I have specified an offset of 32256 (=63*512) bytes for a disk with 63 sectors per track and 512 bytes per sector
You should not need the -t option, but it would not hurt to specify if you know the file system type.
When dd is used to image an extended partition, it includes the extended partition table which is in the first sector of a track. When you do a loop mount, you want to skip over this.
[root@noc-101 ~]# losetup /dev/loop0 /backup/hda5-22oct2008.bak.dd
[root@noc-101 ~]# fdisk -l /dev/loop0
Disk /dev/loop0: 106 MB, 106896384 bytes
255 heads, 63 sectors/track, 12 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/loop0 doesn't contain a valid partition table
allend, thanks for the insight but still the problem remains
Code:
[root@noc-101 ~]# mount -t ext3 -o loop,offset=32256 /backup/hda5-22oct2008.bak.dd /LOOP
mount: wrong fs type, bad option, bad superblock on /dev/loop1,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
[root@noc-101 ~]# dmesg | tail -2
hfs: unable to find HFS+ superblock
VFS: Can't find ext3 filesystem on dev loop1.
Last edited by microcriminal; 10-25-2008 at 08:41 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.