you know I am told to get an image of the whole ubuntu system on my server shared folder.
If you have used dd before to get an image of the occupied space on the system please lemme know bout your command.
(I preferably want dd to only get an image of the occupied file system not the free space)

Well, here comes the next part. You know, though I can view my server shared folder graphically, I cannot do it using shell command. The server has the following path:

Code:

smb://username@safe/mysharedfolder

(username and mysharedfolder have the same name)

I tried different commands for smbclient to connect to the server but it failed. Any helps would be appreciable.

catkin

03-01-2012 10:20 AM

dd will copy everything, including free space but you can a) set the free space to all zeroes and b) compress the output. Assuming the file system you want to copy is / and it is on /dev/sda1, as root:

If the contents of the / file system are changing during the above you will not get a "snapshot in time" so it is better run after booting a standalone system such as Knoppix or a functional live CD/DVD, in which case change /trash as appropriate.

theNbomr

03-01-2012 11:04 AM

It isn't clear whether you want to use the SMB filesystem as the source or as the destination of the dd image. dd works on files and devices, but not on network shares, which are neither. If you want to make a backup of a network share, you are much better off to use either a backup utility (maybe even dd) on the file server host.
If you want to make an image of a partition on a local filesystem, and store the image as a file on a network share, then I suggest mounting the SMB share on your local filesystem before starting to create the dd image, and use the mounted network filesystem as the storage for the dd image.

Making a dd image of a mounted partition is a recipe for BAD THINGS. A file oriented backup using rsync is probably a better idea, and will be more efficient in terms of net data transfer, and size of the resulting copy, although the result will not be a single image file. You can still create a single file version of the backup, if that is what you require for archival or transport purposes.

--- rod.

saman_artorious

03-02-2012 06:34 AM

Quote:

Originally Posted by catkin
(Post 4616065)

dd will copy everything, including free space but you can a) set the free space to all zeroes and b) compress the output. Assuming the file system you want to copy is / and it is on /dev/sda1, as root:

If the contents of the / file system are changing during the above you will not get a "snapshot in time" so it is better run after booting a standalone system such as Knoppix or a functional live CD/DVD, in which case change /trash as appropriate.

I didn't get the last part! in the code you gather all free space in /trash, and then remove trash. So, there only remains occupied space. I don't understand the next step related to live CD/DVD, what that's gonna do with this at all? could you explain it in more detail plz.

and, let's be more accurate here, I need frist to mount my server shared folder using this
mount -t cifs //safe/mysharedfolder -o username=user,password="password" /mnt/share
and then get a backup of whole system n place it on server. this I shall only change the path to file not on root filesystem to /mnt/shared right?

Same as what theNbomr wrote -- using dd to copy a mounted file system is not good so, if it is the / file sytem you want to back up you can't umount it while it is being used to run GNU/Linux. The solution is to boot GNU/Linux from a CD or DVD.

This is very likely to be the root filesystem. Creating an image of the mounted root filesystem will definitely not be a good idea, if you intend to restore it as a working root filesystem image in the future.
--- rod.

saman_artorious

03-02-2012 01:54 PM

Quote:

Originally Posted by catkin
(Post 4616761)

Same as what theNbomr wrote -- using dd to copy a mounted file system is not good so, if it is the / file sytem you want to back up you can't umount it while it is being used to run GNU/Linux. The solution is to boot GNU/Linux from a CD or DVD.

should it be a live cd/dvd? or i can also use the same distribution dvd? and if any, shall simply log in in live mode and then take a backup of the / file system? but would the / file system, when i login from a live cd or dvd? bcoz m not mounting my system anymore whereas the / filesystem of the live cd or dvd is mounted instead!

theNbomr

03-02-2012 02:03 PM

Any CD/DVD that does not mount the partition which you are trying back-up would be suitable. That probably includes most live CDs/DVDs, including most installation CDs. If you can get to a shell, you should be able determine what is mounted by either running mount with no arguments, or inspecting /etc/mtab. Even if the target partition is mounted, you can very likely safely unmount (umount) it for the purpose of making a backup.
--- rod.