# Question about dietpi-backup, usb drive and ext4 format

**URL:** https://dietpi.com/forum/t/question-about-dietpi-backup-usb-drive-and-ext4-format/270
**Category:** Troubleshooting
**Created:** [25 February 2016 17:15 UTC](https://dietpi.com/forum/t/question-about-dietpi-backup-usb-drive-and-ext4-format/270 "2016-02-25T17:15:23Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![skyfly555](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/s/958977/32.png) [@skyfly555](https://dietpi.com/forum/u/skyfly555)
#### Post date: [25 February 2016 17:15 UTC](https://dietpi.com/forum/t/question-about-dietpi-backup-usb-drive-and-ext4-format/270/1 "2016-02-25T17:15:23Z")

</div>

It’s needed a USB drive with ext4 format to use dietpi-backup.

So I’ve taken my vfat usb drive, ubicated with

```nohighlight
df -h

```

, unmounted with

```nohighlight
umount /dev/sda1

```

and formatted with

```nohighlight
mkfs.ext4 /dev/sda1

```

. Then I can go into it in

```nohighlight
/mnt/usb_1

```

.

What happens:  
1- Maybe dietpi-backup says it’s read only.  
2- Maybe during the formatting process I get an error.

I’ve tried, after formatting it, edit "

```nohighlight
/etc/fstab

```

" and uncommenting the line:

```nohighlight
/dev/sda1 /mnt/usb_1 ext4 defaults,noatime,nofail 0 0

```

And commenting the line:

```nohighlight
#/dev/sda1 /mnt/usb_1 vfat defaults,noatime,nofail 0 0

```

And, after that, rebooting.

The time the process has gone better, the USB drive has been formatted without any error messages, dietpi-backup supposedly has done its job and the pendrive has been detected after dietpi-backup, but

```nohighlight
df -h

```

has said it’s only used 60 M when it should be 1 G approx.  
After rebooting, the pendrive hasn’t been detected.

I’ve read on forums than they talk about permissions and so on, but I don’t know what I’m doing wrong.

**Please, can you give me some light? I suppose I’m not formatting the USB drive correctly.**

Thank you very much,

---

<div class="post-metadata">

### Author: ![skyfly555](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/s/958977/32.png) [@skyfly555](https://dietpi.com/forum/u/skyfly555)
#### Post date: [25 February 2016 18:03 UTC](https://dietpi.com/forum/t/question-about-dietpi-backup-usb-drive-and-ext4-format/270/2 "2016-02-25T18:03:42Z")

</div>

Looking at /var/log/dietpi-backup.log, it ends:

```nohighlight
2016/02/25 17:56:00 [2668] rsync: write failed on "/mnt/usbdrive/build/php5-5.6.17+dfsg/pear-build-download/turba-4.2.12.tgz": Input/output error (5)
2016/02/25 17:56:00 [2668] rsync: failed to set times on "/mnt/usbdrive/build/php5-5.6.17+dfsg/pear-build-download/.turba-4.2.12.tgz.NK7Ilf": Read-only file system (30)
2016/02/25 17:56:00 [2668] rsync: rename "/mnt/usbdrive/build/php5-5.6.17+dfsg/pear-build-download/.turba-4.2.12.tgz.NK7Ilf" -> "build/php5-5.6.17+dfsg/pear-build-download/turba-4.2.12.t$
2016/02/25 17:56:00 [2668] rsync error: error in file IO (code 11) at receiver.c(393) [receiver=3.1.1]

```

---

<div class="post-metadata">

### Author: ![Fourdee](https://dietpi.com/forum/user_avatar/dietpi.com/fourdee/32/11_2.png) [@Fourdee](https://dietpi.com/forum/u/Fourdee)
#### Post date: [25 February 2016 21:05 UTC](https://dietpi.com/forum/t/question-about-dietpi-backup-usb-drive-and-ext4-format/270/3 "2016-02-25T21:05:25Z")

</div>

> [@skyfly555](#):
>
> df -has said it’s only used 60 M when it should be 1 G approx.

Sounds like you didn’t clear the partition table before formatting

Heres the code that /DietPi/dietpi/dietpi-external\_drive\_setup uses:

```plaintext
		#Unmount all connected drives
		umount /dev/sd[a-z][1-9]
		#Clear MBR and partition table from device
		dd if=/dev/zero of=/dev/sda bs=512 count=1

		#Create New partition on /dev/sda
		echo -e "o\nn\np\n1\n\n\nw" | fdisk /dev/sda

		#Format ext4
		umount /dev/sd[a-z][1-9]
		echo -e "y" | mkfs.ext4 /dev/sda1
		resize2fs /dev/sda1
		mount -a
		chown -R root:root /mnt/usb_1

```

You can also run the following script to format/setup your USB drive:

```plaintext
/DietPi/dietpi/dietpi-external_drive_setup

```

---

<div class="post-metadata">

### Author: ![skyfly555](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/s/958977/32.png) [@skyfly555](https://dietpi.com/forum/u/skyfly555)
#### Post date: [28 February 2016 01:15 UTC](https://dietpi.com/forum/t/question-about-dietpi-backup-usb-drive-and-ext4-format/270/4 "2016-02-28T01:15:25Z")

</div>

Thank you very much.

Perfect!
