HeL
Posts: 9
Joined: Tue Jan 09, 2018 2:19 pm

dd filled up the SDD disc

Tue Jan 09, 2018 4:04 pm

Hello,
I'm a beginner with Raspbian using a Pi3B,
I installed it with a 16GB SDD, formatted that and wrote Noobs on it. Installed Raspbian, did the suggested updates, followed suggestions of
https://raspberry.tips/raspberrypi-eins ... -rechners/ including changing iptables. Up to that no problem.
Then I started to prepare for a image backup by formatting an 64GB USB stick on Window10 professional using 57,8GB available, NTFS, 4096Bytes, Volumebezeichnung: PiBackup, keine Schnellformatierung
When I used the Raspbian GUI I could open the USB drive but I could not save an edited file. I took me a while to find out that that USB drive can be found on /media/h-pi/PiBackup, and is was only readable. I did a chmod 1777 on that directory. I could then save an edited file. Well, after reboot it was read only again. This still needs to be fixed somehow. Anyhow, did a chmod 1777 again.
Now, found out , that since it is a NOOBS installation it has many partitions on the SDD. I guess I correctly found out that mmcblk0 is the whole SDD. Then I issued a dd command via PuTTY

sudo dd if=/dev/mmcblk0 of=/media/h-pi/PiBackup/backup.img bs=4M status=progress
# it seemed to work by updating below line after a few seconds:
9051308032 Bytes (9,1 GB, 8,4 GiB) kopiert, 1310,69 s, 6,9 MB/s
# I did some work on Windows while it worked but then got this error:
dd: Fehler beim Schreiben von '/media/h-pi/PiBackup/backup.img': Auf dem Gerät ist kein Speicherplatz mehr verfügbar
2159+0 Datensätze ein
2158+0 Datensätze aus
9053822976 Bytes (9,1 GB, 8,4 GiB) kopiert, 1312,3 s, 6,9 MB/s

after that the TAB did no more complete a command but issued instead a strange text.

well, since then I get this when I
sudo reboot
sudo: In die Datei »/var/lib/sudo/ts/h-pi« kann nicht geschrieben werden: Auf dem Gerät ist kein Speicherplatz mehr verfügbar
[sudo] Passwort für h-pi:
h-pi@pi3:~ $ sudo df -h
sudo: In die Datei »/var/lib/sudo/ts/h-pi« kann nicht geschrieben werden: Auf dem Gerät ist kein Speicherplatz mehr verfügbar
[sudo] Passwort für h-pi:
Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf
/dev/root 13G 13G 0 100% /
devtmpfs 458M 0 458M 0% /dev
tmpfs 462M 0 462M 0% /dev/shm
tmpfs 462M 12M 450M 3% /run
tmpfs 5,0M 4,0K 5,0M 1% /run/lock
tmpfs 462M 0 462M 0% /sys/fs/cgroup
/dev/mmcblk0p6 65M 21M 45M 33% /boot
tmpfs 93M 0 93M 0% /run/user/1001

When I plug the USB device into windows it has no backup.img file on drive F
However, when I do
ls -la /media/h-pi/PiBackup
insgesamt 8841640
drwxrwxrwt 2 root root 4096 Jan 7 18:10 .
drwxrwxrwt+ 4 root root 4096 Jan 5 13:18 ..
-rw-r--r-- 1 root root 9053822976 Jan 7 18:32 backup.img

its there but obviously eating up the remaining SDD space!

Now, finaly my questions: Why didn't it write to USB drive but instead somewhere on the SDD?
I guess somewhere I missed some mount statement but it looked ok in the GUI, but I could see that saved file on windows as well
I'm puzzled why PiBackup is under /media/h-pi and not under /media directly. Is the GUI doing a mount but the terminal not?

What did I wrong with the dd command?
What needs to be done to fix all that?

h-pi@pi3:~ $ lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
└─sda1 ntfs PiBackup 108A98168A97F706
mmcblk0
├─mmcblk0p1 vfat RECOVERY FAAB-8523
├─mmcblk0p2
├─mmcblk0p5 ext4 SETTINGS c57678ea-fbfa-48a6-b8b9-e2268e3ae8a9
├─mmcblk0p6 vfat boot CC86-C08B /boot
└─mmcblk0p7 ext4 root 456a78a1-60ab-4336-881b-91b369f0dd9a /

regards, HeL
regards, HeL

User avatar
thagrol
Posts: 3178
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: dd filled up the SDD disc

Wed Jan 10, 2018 1:48 pm

Not sure what is going on but here's a few things to consider.
  1. You say that the USB stick was formatted as NTFS, have you installed ntfs-3g? Without ithat I'd expect it to show up as read only. chmod won't change this so it's possible that you were writing to a mount point with nothing mounted on it (i.e. the SD card)
  2. The GUI mounter only works when the GUI is running and a user is logged in. Outside of that the device will not be mounted even if the mount point exists. As you executed the dd command via putty this may be the issue.
  3. To mount without the GUI/desktop you need to call mount manually:

    Code: Select all

    sudo mount /dev/sda1 /mnt
    (change as needed) or by adding an apropriate line to /etc/fstab and rebooting. If you go the fstab route, include "nofail" in the mount options or the Pi will not boot without the USB drive plugged in.

Mount points are just directories and can be anywhere you like. If nothing has been mounted on them, you'll read and write to whatever device the directories are on.
Arguing with strangers on the internet since 1993.

HeL
Posts: 9
Joined: Tue Jan 09, 2018 2:19 pm

Re: dd filled up the SDD disc

Wed Jan 10, 2018 2:43 pm

Thanks,
yes I did install ntfs-3g!

My next steps will be to delete that File in
/media/h-pi/PiBackup to free up disc space again. Then add a mount point to the table pointing to the previous directory.
Then issue that DD command again - unchanged. Will that Work?
regards, HeL

User avatar
RaTTuS
Posts: 10563
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: dd filled up the SDD disc

Wed Jan 10, 2018 2:52 pm

delete the file
before issuing the dd command - make sure where the large drive is mounted
use
mount
to show you
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

HeL
Posts: 9
Joined: Tue Jan 09, 2018 2:19 pm

Re: dd filled up the SDD disc

Sat Jan 13, 2018 4:59 pm

Thanks,

well the mount shows now:
/dev/sda1 on /media/backup type fuseblk (rw,nosuid,nodev,noexec,relatime,sync,user_id=0,group_id=0,allow_other,blksize=4096)

I could do a dd command and it appears to be on the USB drive!

However, there are two problems now:
1) it went very slow compared to writing it to the SDD card. The data transfer rate was around 655kB/s whereas to the former SDD card it was around 7Mb/s. What can be done to make it faster? Is the Network the problem or the USB drive's write speed?
2) because it was so slow I guess the PC went to sleep mode and puTTY terminated at 7GB .
I expect 13GB.

The only thing I had to add to what has been mentioned before was a umount of the old /media/h-pi/PiBackup

142 h-pi@pi3:~ $ lsblk
143 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
144 sda 8:0 1 57,9G 0 disk
145 └─sda1 8:1 1 57,9G 0 part /media/h-pi/PiBackup
146 mmcblk0 179:0 0 14,9G 0 disk
147 ├─mmcblk0p1 179:1 0 1,6G 0 part
148 ├─mmcblk0p2 179:2 0 1K 0 part
149 ├─mmcblk0p5 179:5 0 32M 0 part /media/h-pi/SETTINGS
150 ├─mmcblk0p6 179:6 0 66M 0 part /boot
151 └─mmcblk0p7 179:7 0 13,2G 0 part /
152 h-pi@pi3:~ $ df -h
153 Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf
154 /dev/root 13G 4,5G 7,8G 37% /
155 devtmpfs 458M 0 458M 0% /dev
156 tmpfs 462M 0 462M 0% /dev/shm
157 tmpfs 462M 13M 450M 3% /run
158 tmpfs 5,0M 4,0K 5,0M 1% /run/lock
159 tmpfs 462M 0 462M 0% /sys/fs/cgroup
160 /dev/mmcblk0p6 65M 21M 45M 33% /boot
161 tmpfs 93M 0 93M 0% /run/user/1001
162 /dev/sda1 58G 89M 58G 1% /media/h-pi/PiBackup
163 /dev/mmcblk0p5 30M 454K 28M 2% /media/h-pi/SETTINGS
164 tmpfs 93M 0 93M 0% /run/user/109
165 sudo blkid
166 sudo nano /etc/fstab
167 cat /etc/fstab
168 sudo mkdir /media/backup
169 ls -la /media
170 sudo mount -a
171 cat /etc/mtab
172 h-pi@pi3:~ $ ls -la /media
173 insgesamt 20
174 drwxr-xr-x 5 root root 4096 Jan 13 11:43 .
175 drwxr-xr-x 22 root root 4096 Dez 26 18:23 ..
176 drwxr-xr-x 2 root root 4096 Jan 13 11:43 backup
177 drwxrwxrwt+ 4 root root 4096 Jan 12 10:18 h-pi
178 drwxr-x---+ 2 root root 4096 Dez 29 11:20 pi
179 sudo umount /media/h-pi/PiBackup
180 sudo mount -a
181 lsblk
182 df -h
183 ls /media/backup
184 sudo reboot
185 lsblk
186 df -h
187 touch /media/backup/testusb.txt
188 ls /media/backup/
189 rm /media/backup/testusb.txt
190 sudo dd if=/dev/mmcblk0 of=/media/backup/backup.img bs=4M status=progress
191 ls -la /media/backup
regards, HeL

HeL
Posts: 9
Joined: Tue Jan 09, 2018 2:19 pm

Re: dd filled up the SDD disc

Sun Jan 14, 2018 1:02 pm

Well, I issued the dd comand now not via PuTTY but at the PI with a terminal.
The speed is the same - very slow - I leave it running to see whether it completes....

So, I obviously got a very slow USB stick. Any suggestion which one to buy for this backup purpose?
Regards, HeL
regards, HeL

Return to “Troubleshooting”