Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Original Poster
Rep:
Yes, fdisk shows 1k blocks by default, so 37,535,841 blocks = 37,535,841,000 bytes. I never had df do what you report, that is report a different size than fdisk, so we'll have to mark it as a bug. Is the partition, /dev/hda1 reporting "no more space left on device"?, or can you write to it?
Click here to see the post LQ members have rated as the most helpful post in this thread.
Yes, fdisk shows 1k blocks by default, so 37,535,841 blocks = 37,535,841,000 bytes. I never had df do what you report, that is report a different size than fdisk, so we'll have to mark it as a bug. Is the partition, /dev/hda1 reporting "no more space left on device"?, or can you write to it?
did I told you how I made this DD?
I only dd the /dev/sda1 to /dev/hda1, the hda was already partitioned by a previous debian install...
hda maintained the partition table, but sda1 is only 15GB, so dd only copied till 15GB... that might be the bug...
anyway i made this again:
Code:
Backups:~# dd if=/dev/zero > /etc/bigfile.file
dd: writing to `standard output': No space left on device
18488385+0 records in
18488384+0 records out
9466052608 bytes transferred in 241.634276 seconds (39175124 bytes/sec)
Backups:/etc# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hda1 15946992 15946992 0 100% /
tmpfs 258272 0 258272 0% /dev/shm
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Original Poster
Rep:
I think you didn't format the larger partition, so it is only formatted as 15 GB. If this is an ext3 file system, format it, and then try dd'ing the smaller partition to it. Better yet, format the larger partition, and copy the smaller partition over as a file in the new file system. Then, mount the file as a loop device, with a live CD (or the rescue option on the linux install CD), like this:
First mount the new drive that you formatted. It should be in /mnt:
mount /mnt/hda1
If not:
mkdir /mnt/hda1
mount /dev/hda1 /mnt/hda1
Then mount the image file you dd'ed to the new file system:
mkdir /mnt/image
mount -o loop /mnt/hda1/imagefile.img /mnt/image
and copy all the files and folders like so:
cp -r /mnt/image/* /mnt/hda1/
Then, umount the loop device:
umount /mnt/image
remove the imagefile.img:
rm imagfile.img
Use the distro installation CD to reinstall the grub boot loader,
and everything should work on the larger drive. It's good practice for when you really have a problem with linux. You need to know how to rescue a system with a CD, or worse, a floppy.
Last edited by AwesomeMachine; 09-08-2006 at 05:33 PM.
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Original Poster
Rep:
I'm not quite sure how to address this.
Quote:
Originally Posted by gendoikari
I'm a to linux but why would I use dd if im not installing 2 distros?
I hate windows( couldn't find one till now) but I'm not getting a new disk
Was there something unclear about the OP. Use of dd is not mandatory. You don't have to use it if you don't want to. You can do many things with Linux, including installing 2 distros, without using dd. Dd is a tool for when you need it. You don't use dd for everything. Now, if you read the OP, in its entirety, and you think you might have a use for dd, try it. I got interested in dd many years ago, when people had to write their own software no matter what. Software companies didn't exist, and the operating system had to do everything. That is when UNIX was written.
UNIX does everything, and very well. Linux is a UNIX clone, and Linux does everything, just like UNIX. That's because of a computer language called "C". C was written by the man who wrote UNIX. He wrote C in order to have a computer language with which to write UNIX. UNIX is the best operating system, and practically every enterprise uses it on some machines. If you know Linux you know UNIX. If you know UNIX you can get a job, anywhere in the world, making tons of money, at the drop of a hat. That's because UNIX is written in C, and all a person needs to do is write a C compiler, which is one program, and UNIX will install on any machine architecture. Any machine that has a C compiler can also run Linux, for free. That makes Linux one of then greatest things there is. The greatest things in life are free.
k, i am patient, and curious, and i am not restless, and i have time, and i am still trying to learn DD properly, i have practially emptied one of My 40Gb to learn this thing, but still i am confused, help me with this...
> Say i had a file in my first filesystem (say FAT32), XXXXbytes just to say, call this file1, and say i know exactly where the file is placed on the HDD, i have another file in second filesystem (say ext2), same size, XXXXbytes, now i also know exactly where this file is kept, now using DD command, i overwrite file2 with file1, will it work, i mean will file2 just be garbage or become file one, will it work if both the filesystems are same, say ext2. (I am not copying the files using filenames, but i will use the Location on Harddisk, hope u understand, so the command looks like dd if=/dev/hda1 skip=...........)
> to be able to use the command more effectively i need to know what part of a HDD is reserved for what, i mean where is the partition tables, what place is reserved for what, where starts the data. Now i know u can brief me upon this, but as i said, i am patient, and would very much like to read something more detailed, descriptive, and easy....
I think you didn't format the larger partition, so it is only formatted as 15 GB. If this is an ext3 file system, format it, and then try dd'ing the smaller partition to it. Better yet, format the larger partition, and copy the smaller partition over as a file in the new file system. Then, mount the file as a loop device, with a live CD (or the rescue option on the linux install CD), like this:
First mount the new drive that you formatted. It should be in /mnt:
mount /mnt/hda1
If not:
mkdir /mnt/hda1
mount /dev/hda1 /mnt/hda1
Then mount the image file you dd'ed to the new file system:
mkdir /mnt/image
mount -o loop /mnt/hda1/imagefile.img /mnt/image
and copy all the files and folders like so:
cp -r /mnt/image/* /mnt/hda1/
Then, umount the loop device:
umount /mnt/image
remove the imagefile.img:
rm imagfile.img
Use the distro installation CD to reinstall the grub boot loader,
and everything should work on the larger drive. It's good practice for when you really have a problem with linux. You need to know how to rescue a system with a CD, or worse, a floppy.
well, I actually have formatted the large partition, cause I installed debian in there, only minimal install, but the installer partitioned the 40GB hard drive. then, I pick the drive and connected to the xp machine, installed drive on vmware program, and then dd'ed the sda1 to sdb1...
knowing this, do that tips above apply to my problem? cause I kinda didn't understand them correctly and I have this server in debian working already in production...
and will that cp work correctly, cause I tried once and it gave me a lot of hard link errors, and I have a lot of hard links used by backuppc program.
thanks
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Original Poster
Rep:
I believe there is a way to include hard and soft links in the cp command. If the server is working, I am glad. You don't need any more instructions from me if the machine is up and running. Congratulations!! :-)
I believe there is a way to include hard and soft links in the cp command. If the server is working, I am glad. You don't need any more instructions from me if the machine is up and running. Congratulations!! :-)
lol, it is working fine, despite that 15GB problem!
I have a temporary HD(80Gb) to put the 40GB data to fix this problem... sorry but I didnt understand correctly your last tips...
so 1st I need to put hda1 (15gb) in hdb1 in some way, but I need to create partitions 1st in this temporary HD right?
then will I need to format the hda1? how is that done?
then, transfer the data back to where it belongs but using all space provided by 37gb partition, how is that dd done?
I have read the 1st post, but it seems that it didnt work the way I liked. sorry but because I'm not good in english maybe I missed some word
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.