Subversion Repositories sysadmin_scripts

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
58 rodolico 1
$ date ; ./insert_space /media/rodolico/backup/testfile 1048576 ; date
2
Wed Oct  9 00:08:50 CDT 2019
3
%sizeof fstat.off_t is 8
4
%Sought size is 107374182400
5
%Adding head-end 1048576 bytes
6
Wed Oct  9 01:43:41 CDT 2019
7
 
8
 
9
 
10
virt 100G
11
mem 31.4
12
res 27.3G
13
shr 27.3G
14
cpu 2%
15
 
16
iotop -o -p 29937
17
19M/s in and out
18
 
19
never touched swap, so did it within
20
 
21
Wed Oct  9 00:08:50 CDT 2019
22
 
23
 
24
fallocate -l 10G /media/rodolico/backup/testfile
25
mkfs.ext4 -m0 -L testdisk /media/rodolico/backup/testfile
26
mount -o loop /media/rodolico/backup/testfile /mnt
27
rsync -av Downloads /mnt
28
umount /mnt
29
insert_space /media/rodolico/backup/testfile 1048576
30
fdisk /media/rodolico/backup/testfile
31
# create first partition at offset 2048, which is 1M assuming 512 byte sectors
32
# partition is 82? Linux ext
33
save
34
kpartx -lv /media/rodolico/backup/testfile
35
kpartx -av /media/rodolico/backup/testfile
36
mount /dev/mapper/testfilep1 /mnt
37
# should be no files copied on following command
38
rsync -av Downloads /mnt
39
 
40
 
41
man 3 getopt
42
 
43
would actually be more flexible if it is assumed the space was already added to the end of the file. The program would move from 0 to filesize-extendsize. In this way, a device like a zfs volume or a lv could be used, simply by appending the correct space to the end, then calling this.
44
question? How does gpartd do it. it moves partitions.