moving data from one folder to another via terminal

dean.viens

Dabbler
Joined
Feb 23, 2023
Messages
32
when i am moving a big directory, it is copying it for some reason and so id don't have enough storage to move everything. why is it doing this? why cant it just move it from one place to another I'm using root, mv /source /destination
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
when i am moving a big directory, it is copying it for some reason and so id don't have enough storage to move everything. why is it doing this?
A couple of points there...

ZFS is a Copy on Write filesystem, so any operation requires free space (even deletion).

If you're moving items within the same dataset, it should effectively just be a rename, so I assume that's not what you're doing.

If you're moving things between different datasets, there's no renaming possible, it must be a copy (followed by a delete). You must have the required space to accommodate that or it won't work.

Check that you don't have snapshots holding onto more space than needed (destroy them if you find any).
 

dean.viens

Dabbler
Joined
Feb 23, 2023
Messages
32
for the sonar and radars setup I don’t think I keep them in seperate data sets. I made media/Usenet data set
Media/torrents dataset
Media/tv shows data set
Should they just be directories? I feel like they should be and this must be a mistake by doing a different data set for each folder.
 

dean.viens

Dabbler
Joined
Feb 23, 2023
Messages
32
A couple of points there...

ZFS is a Copy on Write filesystem, so any operation requires free space (even deletion).

If you're moving items within the same dataset, it should effectively just be a rename, so I assume that's not what you're doing.

If you're moving things between different datasets, there's no renaming possible, it must be a copy (followed by a delete). You must have the required space to accommodate that or it won't work.

Check that you don't have snapshots holding onto more space than needed (destroy them if you find any).
for the sonar and radars setup I don’t think I keep them in seperate data sets. I made media/Usenet data set
Media/torrents dataset
Media/tv shows data set
Should they just be directories? I feel like they should be and this must be a mistake by doing a different data set for each folder.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
But you can also rename entire datasets and they will happily move around the directory tree with their mountpoints.

zfs rename pool/some/path/to/a/dataset pool/different/path/to/new/name

All datasets up to the destination must exist before the operation, in the above example that would be pool/different/path/to/new.
 

dean.viens

Dabbler
Joined
Feb 23, 2023
Messages
32
I should be doing that instead yeah I basically just want them up the directory tree.
 

dean.viens

Dabbler
Joined
Feb 23, 2023
Messages
32
But you can also rename entire datasets and they will happily move around the directory tree with their mountpoints.

zfs rename pool/some/path/to/a/dataset pool/different/path/to/new/name

All datasets up to the destination must exist before the operation, in the above example that would be pool/different/path/to/newi
i basically just want the folder to move a couple spots up the directory tree, but they are all separate data sets unfortunately is what you said still possible?
also since I have some copied becuz the move failed, can i just delete the moved portion because it is just a copy and do what you said if that will work?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Yes of course just as I wrote above - same thing.

zfs rename pool/some/very/deep/path/to/dataset pool/some/dataset will move the dataset 4 levels up.
 

dean.viens

Dabbler
Joined
Feb 23, 2023
Messages
32
Yes of course just as I wrote above - same thing.

zfs rename pool/some/very/deep/path/to/dataset pool/some/dataset will move the dataset 4 levels up.
man, you're a lifesaver it was going to be a rsync nightmare and It has been. I've been learning zfs at the same time and basically, you can only browse files via terminal so it has been a learning curve but I'm almost there. as soon as I do this ill have to work on checking the hard links.
do hard links get created automatically by the app during setup?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Hard links are only valid inside a single filesystem/dataset so what are you referring to? The entire contents of the dataset and any child datasets, too (!) will move.
 

dean.viens

Dabbler
Joined
Feb 23, 2023
Messages
32
Hard links are only valid inside a single filesystem/dataset so what are you referring to? The entire contents of the dataset and any child datasets, too (!) will move.
well I dont have them setup yet persay, I didn't check. I just need to getmy data in the spot I want it first where my apps will read it then I need to deal with hardlinks. i have a hardline /movies but should point to host /mnt/media/movies
I cant see if it works becuz I've been trying to get my stuff there. the one problem I see with what you said is all this data is in one directory which has multiple other directories under one dataset. (truenas imported all my data into one dataset and didn't make separate datasets for each folder in the data it imported. i want to move different directories in the big directory into the dataset I made for movies, shows, etc.. so this is still possible? what you said or do I need to rsync individual folders?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Create new dataset, rsync folder, delete source folder. What I demonstrated moves entire datasets around.

Also /movies to /mnt/media/movies is anything but a hardlink. It could be a symbolic link but if you mean this to be in the TrueNAS host system, that's not possible. All your data goes to /mnt/poolname/...

If you imply a jail here you probably mean a mountpoint. That will work.

Anyway you should familiarize yourself with what hardlinks, symlinks, mountpoints, datasets, directories ... in Unix are.
 

dean.viens

Dabbler
Joined
Feb 23, 2023
Messages
32
Create new dataset, rsync folder, delete source folder. What I demonstrated moves entire datasets around.

Also /movies to /mnt/media/movies is anything but a hardlink. It could be a symbolic link but if you mean this to be in the TrueNAS host system, that's not possible. All your data goes to /mnt/poolname/...

If you imply a jail here you probably mean a mountpoint. That will work.

Anyway you should familiarize yourself with what hardlinks, symlinks, mountpoints, datasets, directories ... in Unix are.
yeah ofc im trying. well when plex is asking host directory. but also a mount directory that I assumed based on trash guide was a hardlink. media is the pool name in that example I save.
 
Top