Link to home
Start Free TrialLog in
Avatar of NetRock6
NetRock6Flag for Canada

asked on

Linux Contiguous File

Hi....
Does anybody know if there exists a good contig like tool for linux to make a  ISO file contiguous.

Thank you for your kind help.
Avatar of Steven Vona
Steven Vona
Flag of United States of America image

Linux does not typically need any defragging.  Unless you are constantly running your disks at 90%+ filled, you should never need to defrag.
Avatar of NetRock6

ASKER

Thanks for your comment.
But Grub4dos complaining and needs continuous ISO file to map. So, it can boot.....
Just semantics: is the message about continuous or contiguous?
Sorry About That .... I meant contiguous!! ;)
OK, what have you tried already and does it matter on which platform you want to create the contiguous file?

Here's a Windows utility :
https://technet.microsoft.com/en-gb/sysinternals/bb897428.aspx
Great .... That is a fair comment, but i am looking for a Linux Utility not Windows...! ;)
Thanks for your help....
So what have you tried already?
Have you tried some of these?

dumpe2fs <devicefile>
filefrag <file>
defragfs <directoryname> -a

http://www.linux-magazine.com/Online/Features/Defragmenting-Linux

The first 2 commands just reports the fragmentation.  The last one does a defrag, but depending on your distribution, you may not have all of those utilities.

The simplest way to defragment a file on any system is to copy it to another disk with enough space on it.  It's best if it's a mostly empty disk.  If your disk disk already mostly empty, you could copy the file then delete the fragmented file.
Hi ...
Thanks for your comments.
I tried : defragfs But it does not find the ISO file, it displays:
Analysis in progress...
The selected directory contains no file!

Any Idea ....
Thanks.
Post which commands you tried exactly with parameters, including the original command (grub4dos) that you need the contiguous file for. Copy/paste the errors you get here as well. Thanks.
I mounted the partition to /mnt/sda9
then:
defragfs /mnt/sda9/med1/ -a

I got this:
defragfs 1.1.1, Released under GPLv3 by John Robson <john.robson@usp.br>, March 2011 (help: $ defragfs / -h)

Analysis in progress...

The selected directory contains no file!

And grub4dos error:
"Error 60: File for drive emulation must be in one contiguous disk area".

Thanks.
Is it the ISO file itself that's not contiguous or the files in the ISO image that are not contiguous?

If it's the ISO file, you should leave the ISO unmounted and run the command in the folder that the ISO file resides.
It is the ISO file.
I did exactly that. Jut mounted the sda9 drive on  /mnt/sda9/ and the iso file is in:  /mnt/sda9/med1/

So, i did
defragfs /mnt/sda9/med1/ -a

Open in new window


Thank you for your help.
Can you try:

defragfs /mnt/sda9 -a
I did already .... same result as;
The selected directory contains no file!
Is the output you posted the full output? If not, please do so. Show an 'ls -l' of the folder you are using. Do you have perl installed and is it working? Are you running as root or using sudo? Which version of defragfs do you have? I've tested with defragfs-1.1.1 and that is working. You can get defragfs here: https://sourceforge.net/projects/defragfs/files/defragfs/defragfs-1.1/

root@bananapi ~ # ls -l /home/samba/tmp
total 617476
-rw-r--r-- 1 root root 632291328 Dec 10 00:03 CentOS-7-x86_64-Minimal-1511.iso
root@bananapi ~ # ./defragfs-1.1.1 /home/samba/tmp -f
defragfs 1.1.1, Released under GPLv3 by John Robson <john.robson@usp.br>, March 2011 (help: $ defragfs / -h)

Analysis in progress...

.

Statistics for /home/samba/tmp

Total Files:			1
Total Fragmented Files:		1
Total Fragments:		1
Fragments per Fragmented File:	1

File Fragmentation Rate:	100 %
Avg File Fragments (1 is best):	2

Most Fragmented Files(for details see /tmp/frags-result):
/home/samba/tmp/CentOS-7-x86_64-Minimal-1511.iso: 2 extents found

You need a defragmentation or Your are using -f parameter!

Please specify the percentage of files should be defrag (1-100) [100] or hit Enter.

Open in new window

Thanks Gerwin for your help ...
> The output is the full output ...
> Executing the little program "Hello World" in perl reveals it is installed /working.
> Running as the root with defragfs-1.1.1.

Thank you again for your help.
Show an 'ls -l' of the folder you are using.
Here is the ls -al output:
total 1964036
drwxrwxrwx 1 root root          0 2016-04-04 09:41 ./
drwxrwxrwx 1 root root       4096 2016-04-04 09:41 ../
-rwxrwxrwx 1 root root 2011168768 2016-03-31 13:45 westBuilding.iso*
Hope this can help to solve the issue.

Thanks.
Access rights are ok but does the filename have an asterisk at the end? If so, remove that and try again.
Tried with "mv" command, but not able to remove the *.
Escape the wildcard like this:

mv "westBuilding.iso*" westBuilding.iso
Tried got the below error;
 mv: cannot stat westBuilding.iso* : No such file or directory
That is the same message that you're getting from the defrag tool. Some weird characters in the file name possibly. Try to get the actual file name by typing:

file west<type TAB or Escape key here>

After typing tab or escape you should have the actual filename, the rename it to loose the special characters and retry the defrag. It just cannot find the file.
Already done that many times .... using the [Tab].
This is not about your real issue anymore...

Try:
mv westBuilding.iso\* westBuilding.iso
Already did that and it says:
File not found.

Could be because it has executable permissions.
When i try to change the file permission using;
chmod -x  westBuilding.iso*
It reports no errors, but still the file has +x.

Thanks.
Copy/move the file to another location then I would say, the x bit is not an issue.
cp or mv does not help too...
Any Other Ideas ....

Thanks.... ;)
mv 'file.iso\*' file.iso

(single  quotes)
I get the below output:

mv: cannot stat 'file.iso\\*' :  No such file or directory.

I thinnk * is meant the file is executable (+x).
I don't think the * means executable.

Can you try these commands to try and show possible special characters in your file name:

ls -lb
ls -lAq

Post back the output. I created a file name containing special characters and they show like this:

test\002\t\r
test???
Thank you so much Gerwin for your help.
I think the issue is with  the file system since defragfs-1.1.1 does not support NTFS, as per my findings.
ASKER CERTIFIED SOLUTION
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial