| Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
| 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
03-01-2012, 08:53 AM
|
#1
|
|
Member
Registered: Sep 2008
Posts: 60
Rep:
|
smbclient & dd
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.
|
|
|
|
03-01-2012, 10:20 AM
|
#2
|
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian Squeeze (server), Slackware 13.37 (netbook), Slackware64 14.0 (desktop),
Posts: 8,358
|
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:
Code:
dd if=/dev/zero of=/trash
rm /trash
dd if=/dev/sda1 conv=sync,noerror | gzip > /path/to/file/not/on/root/filesystem/sda.gz
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.
|
|
|
|
03-01-2012, 11:04 AM
|
#3
|
|
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,271
|
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.
Last edited by theNbomr; 03-01-2012 at 11:08 AM.
|
|
|
|
03-02-2012, 06:34 AM
|
#4
|
|
Member
Registered: Sep 2008
Posts: 60
Original Poster
Rep:
|
Quote:
Originally Posted by catkin
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:
Code:
dd if=/dev/zero of=/trash
rm /trash
dd if=/dev/sda1 conv=sync,noerror | gzip > /path/to/file/not/on/root/filesystem/sda.gz
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?
Code:
dd if=/dev/zero of=/trash
rm /trash
dd if=/dev/sda1 conv=sync,noerror | gzip > /path/to/file/not/on/root/filesystem/sda.gz
Last edited by saman_artorious; 03-02-2012 at 06:39 AM.
|
|
|
|
03-02-2012, 06:40 AM
|
#5
|
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian Squeeze (server), Slackware 13.37 (netbook), Slackware64 14.0 (desktop),
Posts: 8,358
|
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.
|
|
|
|
03-02-2012, 11:13 AM
|
#6
|
|
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,271
|
Quote:
Originally Posted by saman_artorious
Code:
dd if=/dev/zero of=/trash
rm /trash
dd if=/dev/sda1 conv=sync,noerror | gzip > /path/to/file/not/on/root/filesystem/sda.gz
|
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.
|
|
|
|
03-02-2012, 01:54 PM
|
#7
|
|
Member
Registered: Sep 2008
Posts: 60
Original Poster
Rep:
|
Quote:
Originally Posted by catkin
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!
|
|
|
|
03-02-2012, 02:03 PM
|
#8
|
|
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,271
|
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.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:13 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|