WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: mount one partition in to one file not directory  (Read 4408 times)

Offline ibug

  • Jr. Member
  • **
  • Posts: 76
mount one partition in to one file not directory
« on: February 05, 2012, 12:21:43 PM »
is there any wai to mount one partition or one whole disk
 in to one file not directory for example to compress it with mksquashfs


Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: mount one partition in to one file not directory
« Reply #1 on: February 05, 2012, 01:06:13 PM »
Filesystems are mounted onto directories.
Drives or partitions are not mounted. The filesystems they contain are.
You do not mount files.

mksquashfs makes a filesystem image from a source directory.
If you would explain exactly what you are trying to accomplish, perhaps someone can help you.

Offline ibug

  • Jr. Member
  • **
  • Posts: 76
Re: mount one partition in to one file not directory
« Reply #2 on: February 05, 2012, 02:37:51 PM »
is there really no way to make SquashFS of partition
 without copy it in to file

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: mount one partition in to one file not directory
« Reply #3 on: February 05, 2012, 02:43:36 PM »
So you want to make a squashfs file without writing it to a file?
That makes no sense.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11639
Re: mount one partition in to one file not directory
« Reply #4 on: February 05, 2012, 02:58:35 PM »
Hi ibug
This is straight from the info file of  squashfs-tools-4.x.tcz:
Code: [Select]
mksquashfs directory/ filename.extensionnameThe command has two options, a source directory, and a destination file. Since you insist on asking
vague questions rather than just saying what you are trying to accomplish, I can only presume you
are trying to compress an existing file system to get some more space on a hard drive. If that is the
case, then this is the wrong approach, squash file system is read only.

Offline ibug

  • Jr. Member
  • **
  • Posts: 76
Re: mount one partition in to one file not directory
« Reply #5 on: February 05, 2012, 03:37:57 PM »
Hi ibug
This is straight from the info file of  squashfs-tools-4.x.tcz:
Code: [Select]
mksquashfs directory/ filename.extensionnameThe command has two options, a source directory, and a destination file. Since you insist on asking
vague questions rather than just saying what you are trying to accomplish, I can only presume you
are trying to compress an existing file system to get some more space on a hard drive. If that is the
case, then this is the wrong approach, squash file system is read only.

can use
--------
dd if=/dev/sda5 of=/mnt/sda6/dir/sda5.file.copy
mksquashfs /mnt/sda6/dir/ /mnt/sda6/another.dir/sda5.file.copy.sfs
--------

but need
--------
mksquashfs /dev/sda5 /mnt/sda6/another.dir/sda5.file.copy.sfs
--------

need to backup 80GB device with 78GB data
 in to 30GB partition with compression
did use 7zip and it takes only 6GB from 30GB
but it do not compress those 2GB
 which are needed for further data recovery with
double mount sfs then mount partition
and many search engine on it with out any writing to this partition

if 7z this partition
7zip can not be mount or read in real time
 it can only decompress full 80GB

and creating ntfs compressed partition is not good for me

if you know everything now
how to mksquashfs /dev/*

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11639
Re: mount one partition in to one file not directory
« Reply #6 on: February 05, 2012, 03:58:50 PM »
Hi ibug
If I understand you correctly, you want to compress sda5, save it to sda6, mount the saved file
and read it. Try this:
Code: [Select]
mount /mnt/sda5
mount /mnt/sda6
mksquashfs /mnt/sda5 /mnt/sda6/another.dir/sda5.file.copy.sfs
sudo mkdir /mnt/squashed
mount /mnt/sda6/another.dir/sda5.file.copy.sfs /mnt/squashed -t squashfs -o loop
ls -l /mnt/squashed

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: mount one partition in to one file not directory
« Reply #7 on: February 05, 2012, 11:02:08 PM »
As we learned from Roberts earlier post sfs's are not supported.. 
« Last Edit: February 05, 2012, 11:04:40 PM by coreplayer2 »

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11639
Re: mount one partition in to one file not directory
« Reply #8 on: February 06, 2012, 01:28:04 AM »
Hi coreplayer2
I saw that post too. Not knowing what it meant, I Googled  linux sfs  and came up with  Secure File
System  and a reference to extensions for Puppy Linux, so roberts may have meant one of those.
SFS also stands for  squash file system  which is used for packaging extensions.

Offline ibug

  • Jr. Member
  • **
  • Posts: 76
Re: mount one partition in to one file not directory
« Reply #9 on: February 06, 2012, 08:27:29 AM »
Hi ibug
If I understand you correctly, you want to compress sda5, save it to sda6, mount the saved file
and read it. Try this:
Code: [Select]
mount /mnt/sda5
mount /mnt/sda6
mksquashfs /mnt/sda5 /mnt/sda6/another.dir/sda5.file.copy.sfs
sudo mkdir /mnt/squashed
mount /mnt/sda6/another.dir/sda5.file.copy.sfs /mnt/squashed -t squashfs -o loop
ls -l /mnt/squashed

but if you try
mksquashfs /mnt/sda5 /mnt/sda6/another.dir/sda5.file.copy.sfs
it create 4KB size sda5.file.copy.sfs file
 with device or inode inside of it
 not a data stream with MB or GB of data from partition or disk

As we learned from Roberts earlier post sfs's are not supported..

if you do not believe TinyCore support SquashFS4 mount'ing look in:

TinyCore-4.3rc1.iso
boot/core.gz
core.cpio
lib/modules/3.0.3-tinycore/kernel/fs/squashfs/squashfs.ko.gz

and inside of it kernel module named
squashfs.ko
it exist [how could this be] and it is not a blank file

aware and realize fact that every extensions in TC repository in
http://distro.ibiblio.org/tinycorelinux/4.x/x86/tcz/
all *.tcz files are in fact SquashFS4 compressed File System

or if you do not believe TinyCore support creating SquashFS4 read
http://distro.ibiblio.org/tinycorelinux/4.x/x86/tcz/squashfs-tools-4.x.tcz.info

or even download and install http://distro.ibiblio.org/tinycorelinux/4.x/x86/tcz/squashfs-tools-4.x.tcz
and you can run

mksquashfs

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: mount one partition in to one file not directory
« Reply #10 on: February 06, 2012, 09:06:14 AM »
Again, your arguments do not change your original question, or its answer.

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: mount one partition in to one file not directory
« Reply #11 on: February 06, 2012, 09:23:44 AM »
I was assuming that you were using Puppy packages. If you are making extensions with .sfs then you are very likely not using the provided programs to access them. Perhaps manually? No one else seems to have your issues.
10+ Years Contributing to Linux Open Source Projects.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: mount one partition in to one file not directory
« Reply #12 on: February 06, 2012, 12:09:56 PM »
Quote
but if you try
mksquashfs /mnt/sda5 /mnt/sda6/another.dir/sda5.file.copy.sfs

/mnt/sda6 not /dev/sda6. You must mount the FS to be able to make a squashfs file out of it.
The only barriers that can stop you are the ones you create yourself.

Offline ibug

  • Jr. Member
  • **
  • Posts: 76
Re: mount one partition in to one file not directory
« Reply #13 on: February 06, 2012, 12:40:41 PM »
ok again
need to mksquashfs one partition in /dev/sda5 [as one file] in to one compressed file
you need to undestood [then mount sfs and then mount this one file which is inside]
and all without copying with dd

this do not work in any linux because mksquashfs compress original inode instead its data
mksquashfs /dev/sda5 /mnt/sda1/dir/sda5.sfs

this works but first require copy whole partition to another
dd if=/dev/sda5 of=/mnt/sda1/dir/sda5
mksquashfs /mnt/sda1/dir/sda5 /mnt/sda1/dir/sda5.sfs

and
if mount /dev/sda5 in to file /mnt/sda1/dir/sda5
 and /mnt/sda1/dir/sda5 will be same size as /dev/sda5 is
then mksquashfs of this file will be possible and with inode is not possible
do you understand

or if device mapper like in crypt devices will work
« Last Edit: February 06, 2012, 12:49:33 PM by ibug »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: mount one partition in to one file not directory
« Reply #14 on: February 06, 2012, 12:50:19 PM »
I don't get why you want to avoid the mount. If you want a disk dump, squashfs has no advantage over gzip, since it's just compressing the single file - "dd if=/dev/sda5 | gzip > /mnt/sda1/dir/sda5" would work better.

So the main question is, do you want a disk dump, or a file dump?
The only barriers that can stop you are the ones you create yourself.