LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Dumb question. Copy files from iso9660 partition, destination bigger than source? (https://www.linuxquestions.org/questions/linux-newbie-8/dumb-question-copy-files-from-iso9660-partition-destination-bigger-than-source-946379/)

simonspt 05-22-2012 08:17 PM

Dumb question. Copy files from iso9660 partition, destination bigger than source?
 
Hello there!
I'm new to Linux and i have a dumb question.
I have a partition /dev/sda2 type iso9660 and so accessible only in RO mode.
I tried to copy all files from that partition to another rw partition, /dev/sdb1 (USB pendrive)
I noticed that the size of whole sda2 partition is almost 170mb (seen by df -h command) and when i try to copy it, the destination directory is about twice its original size!! How's that possible? I copied it without symlinks ( cp --no-dereference -rvp was the command i used)
I tried also doing a TAR file (TAR doesn't follow symlinks) but the result is the same!
Anyone can tell me why it's happening?
Thanks a lot!! This forum is very helpful! I found many other useful topics for other problems!

Doc CPU 05-23-2012 04:46 AM

Hi there,

Quote:

Originally Posted by simonspt (Post 4685221)
I have a partition /dev/sda2 type iso9660 and so accessible only in RO mode.
I tried to copy all files from that partition to another rw partition, /dev/sdb1 (USB pendrive)

what file system do you have on the USB drive? - Possibly doesn't matter, but I notice you didn't give that information.

Quote:

Originally Posted by simonspt (Post 4685221)
I noticed that the size of whole sda2 partition is almost 170mb (seen by df -h command) and when i try to copy it, the destination directory is about twice its original size!! How's that possible?

Since ISO9660 is a readonly file system, you can do a number of tricks there that you wouldn't normally do on another file system. ISO9660 allows, for instance, to have multiple directory pointing to the very same file, i.e. to the same block number. That would appear very similar to hardlinks on a native Linux file system. As soon as you copy the contents, you get two separate files and twice the space allocated.

Could that be the issue here?

[X] Doc CPU

PS: This isn't a dumb question!

simonspt 05-23-2012 04:53 AM

Quote:

Originally Posted by Doc CPU (Post 4685426)
Hi there,



what file system do you have on the USB drive? - Possibly doesn't matter, but I notice you didn't give that information.



Since ISO9660 is a readonly file system, you can do a number of tricks there that you wouldn't normally do on another file system. ISO9660 allows, for instance, to have multiple directory pointing to the very same file, i.e. to the same block number. That would appear very similar to hardlinks on a native Linux file system. As soon as you copy the contents, you get two separate files and twice the space allocated.

Could that be the issue here?

[X] Doc CPU

PS: This isn't a dumb question!

First of all thanks for the reply! :)
The filesystem on my pen drive is ext3 (made with mke2fs -j /dev/sdb1) but i tried also with ext2 FS type.
I think it could be possible that there are multiple directory pointing.. I've never thought that.. i don't know much about iso9660 filesystem...
All i wanted to do is have an image of the cdrom on my pendrive, but in read write mode so i'm able to edit files in the cdrom. After that i'd put all files in another iso (probably with mkisofs) to have a modified version of the cdrom.

Any suggestion?
Thanks again!

Doc CPU 05-23-2012 05:38 AM

Hi there,

Quote:

Originally Posted by simonspt (Post 4685430)
All i wanted to do is have an image of the cdrom on my pendrive, but in read write mode so i'm able to edit files in the cdrom. After that i'd put all files in another iso (probably with mkisofs) to have a modified version of the cdrom.

as far as I can tell, that leaves you with two options:
  1. Don't care and just accept that you'll need more space
  2. Find out which files are identical, copy just one instance of them and hardlink them among each other

Each of the two has its drawbacks. With method 1, you need to take care that you edit every file of a supposedly identical pair or triple, while method 2 is more effort to analyze, and you have to spend more attention on recreating the ISO with these linked files.

[X] Doc CPU

simonspt 05-23-2012 12:36 PM

I solved by creating a bigger ext3 partition on my pendrive... Well.. not so useful because now the partition takes about a 30% of my 1gig pendrive, vs the 10% usage of iso9660 partition...

That's it! :-)

thanks Doc!


All times are GMT -5. The time now is 12:55 AM.