
따라서 루트 하위 볼륨에 BTRFS 하위 볼륨이 있고 하드 링크와 참조 링크를 그대로 유지하면서 이를 가능한 한 빨리 일반 디렉터리로 변환하고 싶다고 가정해 보겠습니다. 찾을 수 있는 단축키가 있나요? 특히 대용량 하위 볼륨인 경우 이 작업을 몇 초 만에 쉽게 수행하는 방법에 대한 문서를 찾을 수 없습니다.
답변1
간단하게 mv
내용을 읽어보세요. 이와 관련하여 하위 볼륨은 디렉토리에 지나지 않습니다. 하드링크 같은 것으로 간단한 테스트를 해봤는데 간단한 이동만으로도 예상대로 작동했습니다.
$ mkdir tmp
$ cd tmp
$ btrfs subvolume create sub
Create subvolume './sub'
$ echo 1 > file
$ ln file hard
$ echo 2 >> hard
$ cat file
1
2
$ ls -1i file hard
20803239 file
20803239 hard
# create 5 Gb file with random data to see if it later moves (fast) or copies (slower)
$ dd if=/dev/urandom of=rand bs=1G count=5
$ btrfs filesystem du rand
Total Exclusive Set shared Filename
5.00GiB 5.00GiB 0.00B rand
$ cp --reflink=always rand rand-ref
$ echo something >> rand-ref
$ btrfs filesystem du rand
Total Exclusive Set shared Filename
5.00GiB 0.00B 5.00GiB rand
$ btrfs filesystem du rand-ref
Total Exclusive Set shared Filename
5.00GiB 4.00KiB 5.00GiB rand-ref
$ truncate -s 10G sparse
$ btrfs filesystem du sparse
Total Exclusive Set shared Filename
0.00B 0.00B 0.00B sparse
$ ls
file hard rand rand-ref sparse sub
이제 모든 콘텐츠를 하위 볼륨 "sub"로 이동하세요.
$ mv file hard rand rand-ref sparse sub/
결과를 확인하고
$ ls -1i file hard
257 file
257 hard
$ btrfs filesystem du rand rand-ref sparse
Total Exclusive Set shared Filename
5.00GiB 0.00B 5.00GiB rand
5.00GiB 4.00KiB 5.00GiB rand-ref
0.00B 0.00B 0.00B sparse
추신: 하위 볼륨을 변환하고 싶기 때문입니다. 이 작업을 수행하라는 명령이 없다고 생각합니다. 빈 하위 볼륨을 삭제하고 콘텐츠를 다시 이동하는 대신 콘텐츠를 다른 위치로 이동하세요.