1

Referring to @goldilocks Reverse the expand root FS

I'm using the latest Rasbian Stretch and have sent an rsync backup to my NAS which is mounted via an NFS mount. Now I am attempting @goldilocks guide to create a new blank image file on the NAS to send the rsync backup into. There are 2 problems....

"dd if=/dev/zero of=test.img bs=4096 count=1000" creates a 4M file not 40M

Making the file 40M and continuing up to the losetup line where I hit an error that I cannot bypass.

losetup -o 4194304 /dev/loop1 test.img" 

Changing the file.img permissions to 777 doesn't help this error

losetup: /dev/loop1: failed to set up loop device: Permission denied

Is the because Rasbian Stretch is different, or is just me?

Ghanima
  • 15,958
  • 17
  • 65
  • 125
TimR
  • 19
  • 2

1 Answers1

0

Changing the file.img permissions to 777 doesn't help this error

You do need read-write permission on the image file, but the error here is probably about the permissions on the device node in /dev; stat /dev/loop1 will likely show it as 660, uid root, gid disk.

You could change the permissions or ownership on that, but it would probably be better to use sudo, or if that doesn't work, su root and do it (if you don't have a root password set you'll have to sudo passwd root first).

Note the file nodes in /dev are virtual and are created by the kernel, so if you do modify anything the changes will not persist across boot.

goldilocks
  • 60,325
  • 17
  • 117
  • 234